Re: oracle error 'Missing Keyword' ora 00905

From: laly <laly.kattoor_at_bnpparibas.com>
Date: 17 May 2002 01:39:06 -0700
Message-ID: <ef64358b.0205170039.233aca97_at_posting.google.com>


Hello,

I cannot reproduce your error, but I think it will be better if you simply doubles quotes instead of using chr(39) : exemple:

        v_rangeFrom :=' 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'') ';
You will find more easily your mistake

Another solution could be to use paramtered cursor : declare

   cursor myCursor(x IN VARCHAR2) is

      select unique ...
      where  tme_dimn_i = x;

begin

   for r in myCursor('TDTD')
   loop

      ...
   end loop;
end;

HTH, Laly.

klmtechnology_at_consultant.com (Zo) 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 - 10:39:06 CEST

Original text of this message