.ora-code.com

Links
Home
Oracle DBA Forum
Frequent Oracle Errors
TNS:could not resolve the connect identifier specified
Backtrace message unwound by exceptions
invalid identifier
PL/SQL compilation error
internal error
missing expression
table or view does not exist
end-of-file on communication channel
TNS:listener unknown in connect descriptor
insufficient privileges
PL/SQL: numeric or value error string
TNS:protocol adapter error
ORACLE not available
target host or object does not exist
invalid number
unable to allocate string bytes of shared memory
resource busy and acquire with NOWAIT specified
error occurred at recursive SQL level string
ORACLE initialization or shutdown in progress
archiver error. Connect internal only, until freed
snapshot too old
unable to extend temp segment by string in tablespace
Credential retrieval failed
missing or invalid option
invalid username/password; logon denied
unable to create INITIAL extent for segment
out of process memory when trying to allocate string bytes
shared memory realm does not exist
cannot insert NULL
TNS:unable to connect to destination
remote database not found'>ora-02019
exception encountered: core dump
inconsistent datatypes
no data found
TNS:operation timed out
PL/SQL: could not find program
existing state of packages has been discarded
maximum number of processes exceeded
error signaled in parallel query server
ORACLE instance terminated. Disconnection forced
TNS:packet writer failure
see ORA-12699
missing right parenthesis
name is already used by an existing object
cannot identify/lock data file
invalid file operation
quoted string not properly terminated
Dynamic SQL

Dynamic SQL

2006-04-06       - By ora_forum
Reply:     1     2     3     4     5     6     7     8     9     10  

Sorry.
 
                                  *
ERROR at line 9:
ORA-06550 (See ORA-06550.ora-code.com): line 9, column 34:
PL/SQL: ORA-00942 (See ORA-00942.ora-code.com): table or view does not exist
ORA-06550 (See ORA-06550.ora-code.com): line 9, column 14:
PL/SQL: SQL Statement ignored
ORA-06550 (See ORA-06550.ora-code.com): line 11, column 8:
PLS-00204: function or pseudo-column 'ROWID' may be used inside a SQL statement
only
ORA-06550 (See ORA-06550.ora-code.com): line 11, column 5:
PL/SQL: Statement ignored

"Reidy, Ron" <Ron.Reidy@(protected)> wrote:
               You cannot test for NULL with the ?=, <>, !=?, etc. operators.
The correct syntax is ?? IS NOT NULL?.
 
 Also, what is not working?
 
 
 -- --Original Message-- --
From: oracle-l-bounce@(protected) [mailto:oracle-l-bounce@(protected)] On
Behalf Of ora_forum
Sent: Thursday, April 06, 2006 9:53 AM
To: oracle-l@(protected)
Subject: Dynamic SQL
 
   Hi All:

   Could you tell me what I'm doing wrong?

   I need pass different schema owner in SQL, also in some tables there are
multiple records will be returned.

   

     DECLARE
m_dated DATE;
m_count NUMBER(10);
m_details varchar2(4000);
m_moduser varchar2(250);
BEGIN
FOR r IN (SELECT owner FROM all_tables WHERE table_name=upper('Audittrail')
order by owner)
LOOP
FOR n IN (SELECT ROWID FROM r.Audittrail where action=8)
LOOP
IF ROWID<>'NULL' or ROWID<>0 THEN
EXECUTE IMMEDIATE 'SELECT Dated, Details, Moduser FROM ' || R.owner ||'
.Audittrail where rowid='||n||'.rowid' into m_dated, m_details, m_moduser;
dbms_output.put_line ( m_dated,m_details, m_moduser);
ELSE
NULL;
END IF;
END LOOP;
END LOOP;
END;
/

   

   Thanks.


   
-- ---- ---- ---- ---- ---- -----
 
 Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates
starting at 1?/min.

   
-- ---- ---- ---- ---- ---- -----
 This electronic message transmission is a PRIVATE communication which
contains information
which may be confidential or privileged. The information is intended to be for
the use of the individual
or entity named above. If you are not the intended recipient, please be aware
that any disclosure,
copying, distribution or use of the contents of this information is prohibited.
Please notify the sender
of the delivery error by replying to this message, or notify us by telephone
(877-633-2436, ext. 0),
and then delete it from your system.  



   
-- ---- ---- ---- ---- ---- -----
How low will we go? Check out Yahoo! Messenger?s low  PC-to-Phone call rates.
<DIV>Sorry.</DIV>  <DIV>&nbsp;</DIV>  <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *
<BR>ERROR at line 9:<BR>ORA-06550 (See ORA-06550.ora-code.com): line 9, column 34:<BR>PL/SQL: ORA-00942 (See ORA-00942.ora-code.com):
table or view does not exist<BR>ORA-06550 (See ORA-06550.ora-code.com): line 9, column 14:<BR>PL/SQL: SQL
Statement ignored<BR>ORA-06550 (See ORA-06550.ora-code.com): line 11, column 8:<BR>PLS-00204: function or
pseudo-column 'ROWID' may be used inside a SQL statement<BR>only<BR>ORA-06550 (See ORA-06550.ora-code.com):
line 11, column 5:<BR>PL/SQL: Statement ignored<BR><BR><B><I>"Reidy, Ron" &lt
;Ron.Reidy@(protected)&gt;</I></B> wrote:</DIV>  <BLOCKQUOTE class=replbq
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">  
<META content="Microsoft Word 10 (filtered)" name=Generator>  <STYLE>  <!--   /*
Font Definitions */   @(protected)   {font-family:Tahoma;   panose-1:2 11 6 4 3 5
4 4 2 4;}   /* Style Definitions */  
p.MsoNormal, li.MsoNormal, div.MsoNormal   {margin:0in;   margin-bottom:
.0001pt;   font-size:12.0pt;   font-family:"Times New Roman";}  a:link, span
.MsoHyperlink   {color:blue;   text-decoration:underline;}  a:visited, span
.MsoHyperlinkFollowed   {color:blue;   text-decoration:underline;}  p   {margin
-right:0in;   margin-left:0in;   font-size:12.0pt;   font-family:"Times New
Roman";}  span.EmailStyle18   {font-family:Arial;   color:navy;}  @(protected)
Section1   {size:8.5in 11.0in;   margin:1.0in 1.25in 1.0in 1.25in;}  div
.Section1   {page:Section1;}  -->  </STYLE>    <DIV class=Section1>  <DIV class
=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE: 10pt;
COLOR: navy; FONT-FAMILY: Arial">You cannot test for NULL with the ?=, &lt;&gt;
, !=?, etc. operators. The correct syntax is ?? IS NOT NULL?.</SPAN></FONT></DIV
>  <DIV class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT
-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</DIV>
<DIV class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE
: 10pt; COLOR: navy; FONT-FAMILY: Arial">Also, what is not working?</SPAN></FONT
></DIV>  <DIV class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style=
"FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</DIV>  
<DIV class=MsoNormal><FONT face=Arial color=navy size=2><SPAN style="FONT-SIZE:
10pt; COLOR: navy; FONT-FAMILY: Arial"></SPAN></FONT>&nbsp;</DIV>  <DIV class
=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face=Tahoma size=2><SPAN style="FONT
-SIZE: 10pt; FONT-FAMILY: Tahoma">-- --Original Message-- --<BR><B><SPAN style=
"FONT-WEIGHT: bold">From:</SPAN></B> oracle-l-bounce@(protected) [mailto
:oracle-l-bounce@(protected)] <B><SPAN style="FONT-WEIGHT: bold">On Behalf Of
</SPAN></B>ora_forum<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B>
Thursday, April 06, 2006 9:53 AM<BR><B><SPAN style="FONT-WEIGHT: bold">To:<
/SPAN></B> oracle-l@(protected)<BR><B><SPAN
style="FONT-WEIGHT: bold">Subject:</SPAN></B> Dynamic SQL </SPAN></FONT></DIV>
 <DIV class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman"
size=3><SPAN style="FONT-SIZE: 12pt"></SPAN></FONT>&nbsp;</DIV>  <DIV>  <DIV
class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3>
<SPAN style="FONT-SIZE: 12pt">Hi All:</SPAN></FONT></DIV></DIV>  <DIV>  <DIV
class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3>
<SPAN style="FONT-SIZE: 12pt">Could you tell me what I'm doing wrong?</SPAN><
/FONT></DIV></DIV>  <DIV>  <DIV class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT
face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">I need pass
different schema owner in SQL, also in some tables there are multiple records
will be returned. </SPAN></FONT></DIV></DIV>  <DIV>  <DIV class=MsoNormal style
="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE
: 12pt"></SPAN></FONT>&nbsp;</DIV></DIV>  <DIV>
<DIV>  <DIV class=MsoNormal style="MARGIN-LEFT: 0.5in"><FONT face="Times New
Roman" color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">DECLARE<BR>
</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR:
black">m_dated </SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE:
10pt; COLOR: blue">DATE</SPAN></FONT><FONT color=black size=2><SPAN style="FONT
-SIZE: 10pt; COLOR: black">;<BR>m_count </SPAN></FONT><FONT color=blue size=2>
<SPAN style="FONT-SIZE: 10pt; COLOR: blue">NUMBER</SPAN></FONT><FONT color=black
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black">(10);<BR>m_details </SPAN><
/FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue"
>varchar2</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt;
COLOR: black">(4000);<BR>m_moduser </SPAN></FONT><FONT color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue">varchar2</SPAN></FONT><FONT color=black
size=2><SPAN style="FONT-SIZE: 10pt; COLOR:
black">(250);<BR></SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE:
10pt; COLOR: blue">BEGIN<BR>FOR</SPAN></FONT><FONT color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black"> r </SPAN></FONT><FONT color=blue size=2>
<SPAN style="FONT-SIZE: 10pt; COLOR: blue">IN</SPAN></FONT><FONT color=black
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> (</SPAN></FONT><FONT color
=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">SELECT</SPAN></FONT>
<FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> owner <
/SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue"
>FROM</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR:
black"> all_tables </SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE
: 10pt; COLOR: blue">WHERE</SPAN></FONT><FONT color=black size=2><SPAN style=
"FONT-SIZE: 10pt; COLOR: black"> table_name=</SPAN></FONT><FONT color=blue size
=2><SPAN style="FONT-SIZE: 10pt; COLOR:
blue">upper</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt
; COLOR: black">(</SPAN></FONT><FONT color=red size=2><SPAN style="FONT-SIZE:
10pt; COLOR: red">'Audittrail'</SPAN></FONT><FONT color=black size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: black">) </SPAN></FONT><FONT color=blue size=2>
<SPAN style="FONT-SIZE: 10pt; COLOR: blue">order</SPAN></FONT><FONT color=black
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> </SPAN></FONT><FONT color
=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">by</SPAN></FONT><FONT
color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> owner)<BR><
/SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue"
>LOOP<BR>FOR</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt;
COLOR: black"> n </SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE:
10pt; COLOR: blue">IN</SPAN></FONT><FONT color=black size=2><SPAN style="FONT
-SIZE: 10pt; COLOR: black"> (</SPAN></FONT><FONT
color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">SELECT</SPAN><
/FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> <
/SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue"
>ROWID</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR
: black"> </SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt;
COLOR: blue">FROM</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE:
10pt; COLOR: black"> r.Audittrail </SPAN></FONT><FONT color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue">where</SPAN></FONT><FONT color=black size
=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> action=8)<BR></SPAN></FONT><FONT
color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">LOOP<BR>IF</SPAN><
/FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> <
/SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue"
>ROWID</SPAN></FONT><FONT color=black
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black">&lt;&gt;</SPAN></FONT><FONT
color=red size=2><SPAN style="FONT-SIZE: 10pt; COLOR: red">'NULL'</SPAN></FONT>
<FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> </SPAN><
/FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">or<
/SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black
"> </SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR:
blue">ROWID</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt;
COLOR: black">&lt;&gt;0 </SPAN></FONT><FONT color=blue size=2><SPAN style="FONT
-SIZE: 10pt; COLOR: blue">THEN<BR>EXECUTE</SPAN></FONT><FONT color=black size=2>
<SPAN style="FONT-SIZE: 10pt; COLOR: black"> </SPAN></FONT><FONT color=blue size
=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">IMMEDIATE</SPAN></FONT><FONT color
=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> </SPAN></FONT><FONT
color=red size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: red">'SELECT Dated, Details, Moduser FROM '<
/SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black
"> || R.owner ||</SPAN></FONT><FONT color=red size=2><SPAN style="FONT-SIZE:
10pt; COLOR: red">'.Audittrail where rowid='</SPAN></FONT><FONT color=black
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black">||n||</SPAN></FONT><FONT
color=red size=2><SPAN style="FONT-SIZE: 10pt; COLOR: red">'.rowid'</SPAN><
/FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> <
/SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue"
>into</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR:
black"> m_dated, m_details, m_moduser; <BR>dbms_output.put_line ( m_dated,m
_details, m_moduser);<BR></SPAN></FONT><FONT color=blue size=2><SPAN style="FONT
-SIZE: 10pt; COLOR: blue">ELSE<BR>NULL</SPAN></FONT><FONT color=black size=2>
<SPAN style="FONT-SIZE: 10pt; COLOR:
black">;<BR></SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt
; COLOR: blue">END</SPAN></FONT><FONT color=black size=2><SPAN style="FONT-SIZE:
10pt; COLOR: black"> </SPAN></FONT><FONT color=blue size=2><SPAN style="FONT
-SIZE: 10pt; COLOR: blue">IF</SPAN></FONT><FONT color=black size=2><SPAN style=
"FONT-SIZE: 10pt; COLOR: black">;<BR></SPAN></FONT><FONT color=blue size=2><SPAN
style="FONT-SIZE: 10pt; COLOR: blue">END</SPAN></FONT><FONT color=black size=2>
<SPAN style="FONT-SIZE: 10pt; COLOR: black"> </SPAN></FONT><FONT color=blue size
=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">LOOP</SPAN></FONT><FONT color
=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black">;<BR></SPAN></FONT>
<FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">END</SPAN><
/FONT><FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black"> <
/SPAN></FONT><FONT color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue"
>LOOP</SPAN></FONT><FONT color=black
size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black">;<BR></SPAN></FONT><FONT
color=blue size=2><SPAN style="FONT-SIZE: 10pt; COLOR: blue">END</SPAN></FONT>
<FONT color=black size=2><SPAN style="FONT-SIZE: 10pt; COLOR: black">;<BR>/<
/SPAN></FONT></DIV></DIV>  <DIV>  <DIV class=MsoNormal style="MARGIN-LEFT: 0.5in
"><FONT face="Times New Roman" color=blue size=2><SPAN style="FONT-SIZE: 10pt;
COLOR: blue"></SPAN></FONT>&nbsp;</DIV></DIV>  <DIV>  <DIV class=MsoNormal
style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" color=black size=2>
<SPAN style="FONT-SIZE: 10pt; COLOR: black">Thanks.</SPAN></FONT></DIV></DIV><
/DIV>  <DIV class=MsoNormal style="MARGIN-LEFT: 0.5in; TEXT-ALIGN: center" align
=center><FONT face="Times New Roman" size=3><SPAN style="FONT-SIZE: 12pt">  <HR
align=center width="100%" SIZE=1>  </SPAN></FONT></DIV>  <DIV class=MsoNormal
style="MARGIN-LEFT: 0.5in"><FONT face="Times New Roman" size=3><SPAN style=
"FONT-SIZE: 12pt">Talk is cheap. Use Yahoo! Messenger to
make PC-to-Phone calls. <A href="http://us.rd.yahoo.com/mail_us/taglines
/postman7/*http:/us.rd.yahoo.com/evt=39666/*http:/beta.messenger.yahoo.com"
>Great rates starting at 1?/min.</A></SPAN></FONT></DIV></DIV>  <DIV style=
"MARGIN-RIGHT: 0px" align=left><FONT face=Tahoma size=2><FONT color=#0000ff>  
<HR>  </FONT></FONT><FONT face=Tahoma size=2><FONT color=#0000ff>This electronic
message transmission is a PRIVATE communication which contains information <BR
>which may be confidential or privileged. The information is intended to be for
the use of the individual <BR>or entity named above. If you are not the
intended recipient, please be aware that any disclosure, <BR>copying,
distribution or use of the contents of this information is prohibited. Please
notify the sender <BR>of the delivery error by replying to this message, or
notify us by telephone (877-633-2436, ext. 0), <BR>and then delete it from your
system.</FONT></FONT>   <DIV></DIV></DIV></BLOCKQUOTE><BR><p>
    <hr size=1>How low will we go? Check out Yahoo! Messenger?s low <a href="http
://us.rd.yahoo.com/mail_us/taglines/postman8/*http://us.rd.yahoo.com/evt=39663/
*http://voice.yahoo.com"> PC-to-Phone call rates.