Wondering if someone can help me?
I have the following procedure:
CREATE OR REPLACE PROCEDURE MoveProdGroup(p_pgroup in varchar2,p_Brand in varchar2)
AS
l_theCursor integer default dbms_sql.open_cursor;
l_query varchar2(4000);
BEGIN
/*Example EXECUTE MoveProdGroup('670 Boy trousers','SYSADM'); */
l_query:='insert into '||p_Brand||'.styles select * from sysadm.styles where mainkey like '||''''||'%'||p_pgroup||'%'||'''';
DBMS_OUTPUT.PUT_LINE(l_query);
dbms_sql.parse( l_theCursor, l_query, dbms_sql.native );
END;
/
SQL> EXECUTE MoveProdGroup('229 FIX baby*0023*000','LADIES');
insert into LADIES.styles select * from sysadm.styles where mainkey like
'%229 FIX baby*0023*000%'
BEGIN MoveProdGroup('229 FIX baby*0023*000','LADIES'); END;
*
ERROR at line 1:
ORA-00942: table or view does not exist
ORA-06512: at "SYS.DBMS_SYS_SQL", line 782
ORA-06512: at "SYS.DBMS_SQL", line 32
ORA-06512: at "SYSADM.MOVEPRODGROUP", line 11
ORA-06512: at line 1
But running the SQL without DBMS_SQL works fine....
SQL> insert into LADIES.styles select * from sysadm.styles where mainkey like
2 '%229 FIX baby*0023*000%'
3 ;
1 row created.
Can anyone tell me what's wrong...