Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlplus question
Johanne fradet wrote:
> I have win2k
> Oracle 8i (8.1.7.3)
>
> I'm trying to conditionally execute a command in sqlplus based on what the
> user entered in the table.
>
> I tried to resolved that with substitution variable like this
>
> COL cal NEW_VALUE cal;
>
> SELECT DECODE(field_entered,'ANAYLSE',' ','rem') cal
> FROM parm_entered;
>
> &cal ANALYZ TABLE ......;
>
> this does not work because I think that sqlplus is expecting a command at
> the begining of a line
>
> I know I could do the conditional execution of the command by putting the
> analyze command into a file
> and calling that file with the substitution variable like before and it
> would work because the line would
> begin with @ BUT i do not like the idea of creating a file for one line
> of code and was wondering
> if it was possible to trick it to work . I also try to do it through
> PL/SQL but it did not like the ANALYZE
> command(and the exact same command worked direcly in sqlplus)
> so I supposed it is not a command that can be run through PL/SQL.
>
> I hope, I'm not asking something obvious but I did not find my answer in the
> documentation
>
> Thanks in advance
Have you heard of native dynamic SQL?
If not ... investigate it at http://tahiti.oracle.com.
Daniel Morgan Received on Thu Aug 29 2002 - 12:34:08 CDT