| PLS-00103 [message #449824] |
Thu, 01 April 2010 03:56  |
getritesh
Messages: 235 Registered: July 2006 Location: INDIA
|
Senior Member |

|
|
Hi,
I executed the following procedure and got error
SQL> Create Or Replace Procedure proc Is
2 v_rec_cnt Number := 0;
3 g_cur_count sys_refcursor;
4 v_query1 Varchar2(10000):=
5 'Select Count(*)
6 From ( SELECT To_CHAR(SYSDATE,'DD/MM/YYYY')
7 FROM DUAL';
8 Begin
9 Open g_cur_count For v_query1||')';
10 End;
11 /
Warning: Procedure created with compilation errors.
SQL> SHOW ERR
Errors for PROCEDURE PROC:
LINE/COL ERROR
-------- -----------------------------------------------------------------
6/39 PLS-00103: Encountered the symbol "DD" when expecting one of the
following:
* & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LIKE4_ LIKEC_ between || multiset member SUBMULTISET_
The symbol "*" was substituted for "DD" to continue.
6/49 PLS-00103: Encountered the symbol ")
FROM DUAL" when expecting one of the following:
. ( * @ % & = - + ; < / > at in is mod remainder not rem
<an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
LINE/COL ERROR
-------- -----------------------------------------------------------------
LIKE4_ LIKEC_ between || member SUBMULTISET_
The symbol "*" was substituted for ")
FROM DUAL" to continue.
Oracle doc. says
PLS-00103: %s
Cause: This error message is from the parser. It found a token (language element) that is inappropriate in this context.
Action: Check previous tokens as well as the one given in the error message. The line and column numbers given in the error message refer to the end of the faulty language construct.
But i didn't understand
Please tell a solution for this error
Regards,
Ritesh
|
|
|
|
| Re: PLS-00103 [message #449826 is a reply to message #449824] |
Thu, 01 April 2010 04:02   |
cookiemonster
Messages: 13975 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
To get a quote in a string you need to use two quotes together:
From ( SELECT To_CHAR(SYSDATE,''DD/MM/YYYY'')
|
|
|
|
|
|
| Re: PLS-00103 [message #449828 is a reply to message #449826] |
Thu, 01 April 2010 04:20   |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
For 10g and above, I prefer the quoted string delimiter:
v_query1 Varchar2(10000):=
5 q'!Select Count(*)
6 From ( SELECT To_CHAR(SYSDATE,'DD/MM/YYYY')
7 FROM DUAL!';
but each to their own
[Edit: cannae spell]
[Updated on: Thu, 01 April 2010 04:37] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
| Re: PLS-00103 [message #450292 is a reply to message #449861] |
Tue, 06 April 2010 04:39   |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
|
Never thought about it that way Kevin. Great tip, banked for the future (for when I actually start working with Oracle again!).
|
|
|
|
| Re: PLS-00103 [message #450359 is a reply to message #449859] |
Tue, 06 April 2010 12:30   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
Michel Cadot wrote on Thu, 01 April 2010 17:54So when your DBA has to debug/tune the production and look in v$sqltext(_with_new_lines) he/she get a one line query of thousand characters, I think I disagree.
I agree with Kevin. Besides, if a DBA cannot tune a statement because it is not formatted, for GOODNESS sake, let him/her stay away from my statement (and my db as well actually)
|
|
|
|
| Re: PLS-00103 [message #450407 is a reply to message #450359] |
Wed, 07 April 2010 01:26   |
 |
Michel Cadot
Messages: 68776 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
A DBA has many other things to do than to format spend time to format queries and being able to detect an error in a bad written (or wrong) query at first sight in SGA is far better (even for clients) than getting the root of problem after spending a couple of days to format dozen of queries of thousand characters.
Regards
Michel
[Updated on: Wed, 07 April 2010 07:40] Report message to a moderator
|
|
|
|
|
|
| Re: PLS-00103 [message #450466 is a reply to message #450463] |
Wed, 07 April 2010 07:44   |
 |
Michel Cadot
Messages: 68776 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
SQL> select sql_fulltext from v$sql where sql_fulltext like '%fga$%';
SQL_FULLTEXT
---------------------------------------------------------------------------------------
Declare
nb pls_integer := 0;
Begin
dbms_output.put_line (' ');
For rec in (
select owner, view_name, text
from dba_views
where text_length < 32*1024
order by 1, 2
) loop
If upper(rec.text) like '%'||upper('fga$')||'%' then
dbms_output.put_line (rec.owner||'.'||rec.view_name);
nb := nb + 1;
End if;
End loop;
If nb > 1 then
dbms_output.put_line (' ');
dbms_output.put_line (nb||' views found');
Elsif nb > 0 then
dbms_output.put_line (' ');
dbms_output.put_line (nb||' view found');
Else
dbms_output.put_line ('No view found');
End if;
dbms_output.put_line (' ');
nb := 0;
For rec in (
select owner, view_name, text_length
from dba_views
where text_length >= 32*1024
order by 1,2
) loop
If nb = 0 then dbms_output.put_line ('Skipped view(s):'); End if;
dbms_output.put_line
(' '||rec.owner||'.'||rec.view_name||': '||rec.text_length);
nb := nb + 1;
End loop;
If nb > 0 then
dbms_output.put_line (' ');
End if;
End;
select sql_fulltext from v$sql where sql_fulltext like '%fga$%'
2 rows selected.
When input is formatted output is.
Regards
Michel
[Updated on: Wed, 07 April 2010 07:45] Report message to a moderator
|
|
|
|
|
|