?
Solved

PL-SQL Delete statement

Posted on 2011-02-23
4
Medium Priority
?
296 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1000 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 1000 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video shows how to configure and send email from and Oracle database using both UTL_SMTP and UTL_MAIL, as well as comparing UTL_SMTP to a manual SMTP conversation with a mail server.
Suggested Courses

777 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