SQL & PL/SQL :: Procedure To Delete Duplicity From The Database?

Jul 11, 2010

here is a procedure to delete duplicity from the database

DECLARE
CURSOR A IS SELECT DISTINCT S_NO FROM S_TAB;
X VARCHAR2(14);
BEGIN
LOOP
OPEN A;
FETCH A INTO X;
DELETE FROM S_TAB

[code].....

but this is slowing the database performance due to not in clause.

View 2 Replies


ADVERTISEMENT

SQL & PL/SQL :: Avoid Duplicity In String

Mar 5, 2013

I have created a procedure which sends mail to the users by using the smtp operation. I am collecting the email id of the users and then concatenating the same using the loop.

Everything is working fine, but if some person is coming multiple times in the loop, then his/her name is shown multiple times in the CC/BCC part (Although mail is sent once), it should be restricted to one time.

what i am doing is:

I have declared id_collector and it is concetenating the email as per the condition loop

........ some code here....
id_collector:=id_collector||email_id||';';
end loop;

Now, I want to check before concatenating that email already exists or not.

Example:

suppose value of id_collector= 'abc@gmail.com;pqr@gmail.com;rst@gmail.com;xyz@gmail.com;'
and again if email id comes - 'abc@gmail.com', then it should get rejected.

I think it can be done using reg_exp but I have messed up with that.

View 2 Replies View Related

PL/SQL :: Conditional Delete Procedure?

Jul 25, 2013

I am trying to create procedure to delete data from audit table but don't know where to start with..

1. Procedure will run on first Saturday of the month (not sure is it possible via pl/sql or have to create separate job)
2. Delete data older than 2 months from Mon - Sat and date shouldn't be 1st of the month. (i.e. leave Sunday & 1st of the month data older than 2 months) e.g.{code}

Procedure delete_log
IS
BEGIN
delete from audit_logs
where created >= trunc(sysdate - 60) and created < trunc(sysdate)
and created != (Sunday)
and created != (First of the month);

View 10 Replies View Related

SQL & PL/SQL :: Procedure Has Got Several Update And Delete Statements

Oct 23, 2013

One of the procedures that am working on is failing with ORA-0000: normal, successful completion error.

The procedure has got several update and delete statements and have logging enabled after each step. The problem with that again is, each time the log table gets updated thereby losing the history of until what point the procedure ran successfully.I have this issue only in production environment and unable to simulate it in dev environment which limits my options of troubleshooting the procedure code. I was using SQLERRM in the code.

Is there a way I can identify the bad records/ record causing this issue? Am very new to PL/SQL and do not know how to proceed with this.How do you debug this sort of issues??(where one procedure internally invokes another one which again invokes other one etc)

View 27 Replies View Related

SQL & PL/SQL :: Data Manipulation Insert - Procedure / Trigger Should Delete Initial Record Saved

Aug 30, 2012

i have one table ot_ins_item where user will enter the details of item, grade,item qty , later on user will go and update the same table the details of different grades received for the same item in different columns with qty breakup in 3 different fields it_qty_01 , it_qty_02,it_qty_03 respectively with different grades , what i need is i want is whenever he updates this table with different grades based on data entered in 3 different fields , a procedure or trigger should delete the initial record saved and insert three different rows based on newly updated values , it may be 3 or it may be 2 sometime depending upon input values that many records should be inserted same time controlling the qty's entered in breakup not exceeding the main qty.

CREATE TABLE ot_ins_item (it_ins_no NUMBER,it_no NUMBER,it_grade VARCHAR2(12),
it_code VARCHAR2(12),it_qty NUMBER,it_flex_01 VARCHAR2(12),
it_01_qty NUMBER,it_flex_02 VARCHAR2(12),it_02_qty NUMBER,it_flex_03 VARCHAR2(12),
it_03_qty NUMBER);

create sequence s_it_no start with 1 ;

INSERT INTO OT_INS_ITEM VALUES (1,s_it_no.NEXTVAL,'A','ITEM1',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO OT_INS_ITEM VALUES (1,s_it_no.NEXTVAL,'B','1TEM2',NULL,NULL,NULL,NULL,NULL,NULL);
INSERT INTO OT_INS_ITEM VALUES (1,s_it_no.nextval,'C','ITEM3',NULL,NULL,NULL,NULL,NULL,NULL);
SELECT * FROM OT_INS_ITEM;
[code]....

View 5 Replies View Related

SQL & PL/SQL :: Procedure To Delete Records / Count Number Of Records Has Been Deleted

Feb 21, 2011

I have written the following PL/SQL procedure to delete the records and count the number of records has been deleted.

CREATE OR REPLACE PROCEDURE Del_emp IS
del_records NUMBER:=0;
BEGIN
DELETE
FROM candidate c
WHERE empid in
(select c.empid
from employee e,
candidate c
where e.empid = c.empid
and e.emp_stat = 'TERMINATED'
);
[code]....

View 6 Replies View Related

SQL & PL/SQL :: Cannot Update And Delete Row From Database

Jan 31, 2011

I can not update and delete row from database

View -1 Replies View Related

Server Administration :: How To Delete A Database

Feb 5, 2012

How can i delete a database? i using the dbca,but the Delate a Database can not use,why?

View 3 Replies View Related

Server Administration :: How To Delete All Objects From Database

Jul 30, 2012

How can I delete all the objects from my database?

View 18 Replies View Related

Audit Delete And Update On All Tables Of Database?

Jun 14, 2013

Was going through this and found that

“AUDIT DELETE ANY TABLE BY <username> BY ACCESS” or “AUDIT UPDATE ANY TABLE<username> BY ACCESS”

enable audit for delete and updates for  given username/schema.  I want to enable auditing on delete and update on my entire database. 

Why? And have we tested it in our any of existing setup?  I am thinking of “Trigger after delete” but again this logic gets struck at individual tables. It do not work simply once and all for complete database/all users/all schemas

View 15 Replies View Related

Server Administration :: Unable To Delete A Database Using Dbca?

Sep 17, 2012

I am trying to delete a database using dbca, but the database configuration option and delete option are not enabled. It's grayed.

View 1 Replies View Related

PL/SQL :: To Delete Child Records Manually Without Using Oracle Delete Cascade

Oct 9, 2012

I have to write a procedure that accepts schema name, table name and column value as parameters....I knew that i need to use metadata to do that deleting manually.

View 9 Replies View Related

Data Guard :: How To Delete Archivelog In Standby Database When Applied Successfully

Aug 20, 2008

How to make the automatic deletion of all the archivelogs when it is applied successfully on the standby database? We have 1 primary database and 1 standby database using oracle physical dataguard.

In the primary database, we have daily backup job so that the applied archivelogs are deleted automatically, no problem

But in the standby database ( physical standby) I have to go there and delete manually because I don't issue backup on this database. Is there any solution for this problem.

View 3 Replies View Related

SQL & PL/SQL :: Procedure Parameter From Database Column

Feb 7, 2011

I knew procedure can be run like 'EXEC (****);' and can be written like

'Create or replace procedure(**** IN VARCHAR2)

BEGIN
END
/

But the requirements are 'Parameter can be come from referencing DB table column?')

If table has value like PARMTAG PARMVAL, I read LOGSTORETYPE data and if exist, fetch the PARMVAL value 7 to my parameter? LOGSTORETYPE 7

Is it possible?

The reason is batch process was written by ProC and DB upgrade time with exadata, we want to change batch to Procedure about our DB delete.

View 2 Replies View Related

SQL & PL/SQL :: How To Find Out Stored Procedure In Database

Jun 20, 2011

There is one DBMSJOB i created schedule to run every day at 22:00 hrs. The jobname is IT_TO_DUM_LOADING and the job type is Stored procedure.

I queried all_source and found stored procedure does not exist in database.

SQL> select text from all_source
2 where type = 'PROCEDURE'
3 and name ='IT_TO_DUM_LOADING';

no rows selected

But i could see the job details in dba_scheduler_jobs view. I cannot use WHERE clause in dba_scheduler_jobs to restrict and find only the job row as i receive time zone error. How it is possible to view the job in dba_scheduler job view whereas i could not find the stored procedure of its in all_source?

View 7 Replies View Related

SQL & PL/SQL :: Dynamic Database Link In Procedure?

Jun 7, 2011

Is it possible create dynamically database link within procedure.

It give me the following error

ORA-01031: insufficient privileges

But i can drop database link within procrdure.

Is there any way to do this?

View 4 Replies View Related

Procedure To Link Oracle 9i Database Server?

Jun 17, 2009

the procedure to link oracle 9i database server withi 10i.

View 1 Replies View Related

SQL & PL/SQL :: Calling Database Link Dynamically For A Procedure

Feb 15, 2011

How to call a procedure by passing the db link dynamically.

View 1 Replies View Related

Procedure For Cloning Database On Same Machine / Server

Jul 19, 2012

Send me the procedure for cloning a database on the same machine / server .

View 1 Replies View Related

Trace Particular Object (procedure / Package) On Database?

Dec 13, 2012

How do I trace an particular object (procedure/package) on the database. my database version is Oracle 11g(11.2.0.2)

View 2 Replies View Related

Unable To Debug Procedure In 11g Database Using PL/SQL Developer

Mar 21, 2013

We have recently migrated our database from 10.2.0.4 to 11.2.0.2. We were able to debug procedures using PL/SQL Developer earlier but after 11g migration we are not able to debug the same procedure in 11g database.

Is it that we require 11g PL / SQL developer with 11g client installed to debug?

View 1 Replies View Related

Executing Stored Procedure / Function From Database Link?

Feb 24, 2011

I have 2 databases:

Database A
Database B

In Database A I have a series of config tables and stored procedures/functions In Database B I have a lot of tables.

I would like to execute my stored procedures and all associated functions in database A on my data in database B.

Now I've figured out that creating a database link enables me to do SQL selects on data in both A and B...but how do I run SP/Funcs ? I've read something about packages but not sure if I'm heading in the right direction.

Do I need to create a simple synonym ? Can I use the existing DB link ? or is there a special way of calling them, or...

I like the A/B database set up since I can keep battle tested code in one location and have it work across multiple dbs...saves me having to create everything in every database.

View 2 Replies View Related

Application Express :: Creating Procedure Using Database Package

Oct 23, 2012

I have created a procedure within a database package, but when I want to create a form based on procedure but I can't call it. I think that I have to use prefix, I am a beginner in database and I don't know how to do this.

View 4 Replies View Related

Windows / .NET :: Procedure To Connect To Oracle Database From MS Access?

Nov 29, 2012

let me know the procedure to connect to Oracle Database from Ms-Access.

We are using Windows as Operating System.

View 1 Replies View Related

RMAN :: Complete Procedure To Restore Database On New Location

Aug 29, 2012

I have taken full backup of database plus archivelog. Then copied them to new server..I want the complete procedure to restore the database on new location.

View 3 Replies View Related

PL/SQL :: Insert Multiple Records On A Database Using Stored Procedure

Mar 25, 2013

I want to insert multiple records on a database using a stored procedure.

View 11 Replies View Related

Forms :: Calling Procedure At (Form / Library And Database) Level

Mar 17, 2011

I've a procedure let us say SALES_PROC on Form Level and same procedure in Library and in Database also.

-How to call SALES_PROC created at Form Level?
-How to call SALES_PROC created at Library Level (.PLL)?
-How to call SALES_PROC created as stored procedure in Database?

View 5 Replies View Related

SQL & PL/SQL :: How To Create Procedure To Read Data From Database And Export It Into CSV Format

Dec 12, 2012

How to create a procedure to read data from database and export it into .csv format without using utilities

View 15 Replies View Related

PL/SQL :: Calling A Function In Remote Database Inside A Stored Procedure

Apr 9, 2013

There are 2 Oracle databases with pseudo names Remote and Local. I have a function in Remote called FUS.F_Return_10 which simply returns 10 for testing purposes, where FUS is a schema name. In Local I want to create a procedure that will call the above function. Here's the PL/SQL:

CREATE OR REPLACE PROCEDURE TEST
(
V_COUNT OUT NUMBER
)
AS
V_FOO NUMBER(2,0);
BEGIN

[Code]...

There's a Public Database Link called PER_ACC in Local. When I try to create this procedure I get: Encountered symbol "@" when expecting one of the following: .(*%&................

where my mistake is?

View 7 Replies View Related

Server Utilities :: Export Procedure Views Function And Packages In Database

Sep 29, 2010

How to export the procedure,views,function and packages in a database, by using Export commmand.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved