Solved

PL-SQL Delete statement

Posted on 2011-02-23
4
259 Views
Last Modified: 2012-08-14
Hi, I am trying to delete records from one table upon reletion to the other
somephing like this:

 
DELETE STATEMENTS A
FROM reverselines T
WHERE A.ACCNO = T.ACCNO AND A.FIYID= T.FIYID AND A.PERID = T.PERID AND A.LINENO = T.LINENO

Open in new window


I am new to PL-SQL and I need help on that.

Thank you for your help.



0
Comment
Question by:rkanabus
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 total points
ID: 34958806
this should do, presuming you want to delete from Statements table. otherwise, you just reverse the 2 table names
DELETE STATEMENTS A
WHERE EXISTS( SELECT NULL 
   FROM reverselines T
       WHERE A.ACCNO = T.ACCNO AND A.FIYID= T.FIYID AND A.PERID = T.PERID AND A.LINENO = T.LINENO
  )

Open in new window

0
 
LVL 19

Assisted Solution

by:elimesika
elimesika earned 250 total points
ID: 34958825
try this
DELETE FROM STATEMENTS A
WHERE EXISTS
  ( select  A.ACCNO
     from  reverselines T
     WHERE A.ACCNO = T.ACCNO AND 
           A.FIYID= T.FIYID AND
           A.PERID = T.PERID    AND 
           A.LINENO = T.LINENO );

Open in new window

0
 

Expert Comment

by:mnaeemsattar
ID: 34958850
You can't use table or view name before the 'From' clause in plsql.  so right statement should be like this:

 
DELETE 
FROM STATEMENTS A, REVERSELINES T
WHERE A.ACCNO = T.ACCNO AND A.FIYID= T.FIYID AND A.PERID = T.PERID AND A.LINENO = T.LINENO

Open in new window

0
 

Author Comment

by:rkanabus
ID: 34958856
Hi, thank you for your help, both solutions are correct.



0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now