Home » SQL & PL/SQL » SQL & PL/SQL » PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context (11.1.0.6)
PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context [message #509819] Wed, 01 June 2011 03:52 Go to next message
gopieee16
Messages: 28
Registered: May 2011
Location: Chennai
Junior Member

we want to delete the duplicate rows in the table by passing dynamic values so I created following procedure but i'm facing a error "PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context" while executing the procedure

CREATE OR REPLACE PROCEDURE test1_parse (p_tablename IN VARCHAR2, pvalue VARCHAR2)
IS 
den VARCHAR2(789);
den1 VARCHAR2(789);
den2 VARCHAR2(789);
den3 VARCHAR2(789);
l_c_1 VARCHAR2(23);
l_c_4 VARCHAR2(23);
l_c_2 VARCHAR2(23);
l_c_3 VARCHAR2(23);
sqlquery VARCHAR2(4000);
mytable VARCHAR2(23); 

BEGIN

den := substr (pvalue,((instr (pvalue, ',',1,1)+1)),(((instr (pvalue, ',',1,2))) - (((instr (pvalue, ',',1,1)+1)))));
den1 := substr (pvalue,((instr (pvalue, ',',1,2)+1)),(((instr (pvalue, ',',1,3))) - (((instr (pvalue, ',',1,2)+1)))));
den2 := substr (pvalue,((instr (pvalue, ',',1,3)+1)),(((instr (pvalue, ',',1,4))) - (((instr (pvalue, ',',1,3)+1)))));
den3 := substr (pvalue,((instr (pvalue, ',',1,4)+1)),(((instr (pvalue, ',',1,5))) - (((instr (pvalue, ',',1,4)+1)))));


SELECT den INTO l_c_1 FROM dual; 
SELECT den1 INTO l_c_2 FROM dual; 
SELECT den2 INTO l_c_3 FROM dual; 
SELECT den3 INTO l_c_4 FROM dual; 
sqlquery := 'delete from ' || p_tablename || ' where ROWID' || ' NOT IN '|| ' ( select MAX (ROWID) from ' || p_tablename || ' where ' || l_c_1 || ' in ( select' || l_c_1 || ' from ' || p_tablename || ' group by ' || l_c_1 || ' having count(*) > 1 ) group by ' || l_c_1 || ')';
EXECUTE IMMEDIATE sqlquery; 
END test1_parse;


SQL> execute test1_parse (t1, ',c1,c2,c3,')
BEGIN test1_parse (t1, ',c1,c2,c3,'); END;

*
ERROR at line 1:
ORA-06550: line 1, column 20:
PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored




CM: fixed [code] tags. They are [code] and [/code] not (code)

[Updated on: Wed, 01 June 2011 03:54] by Moderator

Report message to a moderator

Re: PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context [message #509820 is a reply to message #509819] Wed, 01 June 2011 03:56 Go to previous messageGo to next message
cookiemonster
Messages: 13968
Registered: September 2008
Location: Rainy Manchester
Senior Member
Standard method for debugging dynamic sql:
Assign the dynamic statement to a variable.
Output the variable using dbms_output or similar.
Copy and paste output into sqlplus and see what happens.
Re: PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context [message #509822 is a reply to message #509820] Wed, 01 June 2011 04:01 Go to previous messageGo to next message
cookiemonster
Messages: 13968
Registered: September 2008
Location: Rainy Manchester
Senior Member
Also, what is the point of this:
SELECT den INTO l_c_1 FROM dual; 
SELECT den1 INTO l_c_2 FROM dual; 
SELECT den2 INTO l_c_3 FROM dual; 
SELECT den3 INTO l_c_4 FROM dual;

Why not just use the den variables in the dynamic string?
Re: PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context [message #509823 is a reply to message #509819] Wed, 01 June 2011 04:02 Go to previous messageGo to next message
c_stenersen
Messages: 255
Registered: August 2007
Senior Member
gopieee16 wrote on Wed, 01 June 2011 10:52
execute test1_parse (t1, ',c1,c2,c3,')
BEGIN test1_parse (t1, ',c1,c2,c3,'); END;

*
ERROR at line 1:
ORA-06550: line 1, column 20:
PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored


t1 should be 't1' in your procedure call.
Re: PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context [message #509824 is a reply to message #509823] Wed, 01 June 2011 04:06 Go to previous messageGo to next message
cookiemonster
Messages: 13968
Registered: September 2008
Location: Rainy Manchester
Senior Member
I wasn't paying attention there obviously.
Re: PLS-00357: Table,View Or Sequence reference 'T1' not allowed in this context [message #509842 is a reply to message #509824] Wed, 01 June 2011 05:34 Go to previous message
gopieee16
Messages: 28
Registered: May 2011
Location: Chennai
Junior Member

Hey! thanks for all your comments
I resolved that query

thanks for your time in looking into this
Previous Topic: Fetching data from table
Next Topic: SQL error
Goto Forum:
  


Current Time: Sat Aug 30 06:23:11 CDT 2025