Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlplus question

Re: sqlplus question

From: Ed Prochak <edprochak_at_adelphia.net>
Date: Thu, 29 Aug 2002 19:12:44 GMT
Message-ID: <Mmub9.17493$w51.5272298@news2.news.adelphia.net>

Johanne fradet <fradjoh_at_magma.ca> wrote in message news:Rehb9.10262$V21.218573_at_news...
> 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
>

What's so bad about a one line script file?

Actually, there are a couple ways I might approach this. Presumably the script is part of job run periodically?

Wrap the SQL in a shell script (batch in the windows world) or use PERL! Ed Received on Thu Aug 29 2002 - 14:12:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US