Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-06512 error

SVKJan 10 2018 — edited Jan 10 2018

Hi all,

I'm new to this script languages and my question is

I have 2 tables and want to compare 2 tables and want to delete records from table B if those records does not exisit in table A

for that I need to have write a Stored procedure

so my SP looks as below

CREATE OR REPLACE PROCEDURE SP(
    iTABLENAME IN VARCHAR2,
    iMODELID   IN NUMBER )
AS
BEGIN

  EXECUTE IMMEDIATE 'DELETE FROM' || iTABLENAME || 'WHERE vchaccount NOT IN (select VCHCHILDMEMBERNAME
    from TabbleA
    where' || iMODELID ||' = ''imodelid'' and CHCHILDTYPE = ''D'' and VCHDIMENSIONTYPENAME = ''Account'' );';
   
END SP;

when I turn this to a script it gives me correct result, but when I ran this as Store Procedure it gives me error: "ORA-06512"

don't know what is wrong

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 7 2018
Added on Jan 10 2018
20 comments
1,835 views