Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sqlplus question
Johanne fradet wrote:
> Thank you Daniel for the answer.
>
> For Analyze, Native dynamic sql would work but sometimes we need to execute
> SQLplus command conditionally
> like EXIT when certain criteria are met so is it possible to do that without
> writing the command to a file?
> Daniel Morgan <dmorgan_at_exesolutions.com> wrote in message
> news:3D6E5AF6.D63DCC8E_at_exesolutions.com...
> > 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
> >
A file has nothing to do with it. Write it into a stored procedure.
Daniel Morgan Received on Fri Aug 30 2002 - 13:04:01 CDT