Re: oracle error 'Missing Keyword' ora 00905

From: Prasad Yarlagadda <prasad.yarlagadda_at_motorola.com>
Date: Fri, 17 May 2002 11:32:07 -0500
Message-ID: <ac3bac$3od2_at_nntp.cig.mot.com>


Another solution is to put your dynamic sql statement in quotes and do a select from dual. It shows you whatever is the select statement that is going to be executed.

Something like this

select 'SELECT unique (add_months(last_day(bus_cal_d)+1,-1)) '|| ' FROM cscadmin.business_calendar '||' WHERE to_CHAR(bus_cal_d,'|| chr(39)||

'MON,YYYY' || chr(39) ||') = (SELECT to_char(date_d,'|| chr(39) ||
'MON,YYYY' || chr(39) ||') ' || '  FROM TIME_DIMN ' ||' WHERE tme_dimn_i = '
|| chr(39) || 'TDTD' || chr(39) ||') '

from dual

This will give you

'SELECTDISTINCT(ADD_




SELECT unique (add_months(last_day(bus_cal_d)+1,-1)) FROM cscadmin.business_
calendar WHERE to_CHAR(bus_cal_d,'MON,YYYY') = (SELECT to_char(date_d,'MON,YYYY') FROM TIME_DIMN WHERE tme_dimn_i = 'TDTD')

In that check if you are doing select properly. I am trying to solve your problem, but this will help you identifying the problem.

HTH,
Prasad

"Zo" <klmtechnology_at_consultant.com> wrote in message news:b0d0f796.0205160748.120a72f5_at_posting.google.com...
> Here's the code:
> v_rangeFrom :=' SELECT unique (add_months(last_day(
> bus_cal_d)+1,-1)) '||
> ' FROM cscadmin.business_calendar '||
> ' WHERE to_CHAR(bus_cal_d,'|| chr(39)||
> 'MON,YYYY' || chr(39) ||') = (SELECT to_char(date_d,'|| chr(39) ||
> 'MON,YYYY' || chr(39) ||') ' ||

>

> ' FROM TIME_DIMN ' ||
>
> ' WHERE tme_dimn_i = ' || chr(39) || 'TDTD' ||
> chr(39) ||') ';
>

> In dynamic pl/sql, I'm trying to extract a date and set to a variable,
> v_rangeFrom is showing the entire select statement if I were to print
> out the variable. I'm trying to extract a specific date from a table
> to load into the variable, but I'm getting an oracle ora 00905 error
> keyword missing.
>
> help please???
Received on Fri May 17 2002 - 18:32:07 CEST

Original text of this message