Testing for <NULL> Parameters in SQL*PLUS

From: Lez Oxley <lezo_at_syma.sussex.ac.uk>
Date: 19 May 92 09:45:01 GMT
Message-ID: <1992May19.094501.15784_at_syma.sussex.ac.uk>


One can run a SQLPLUS script as follows:-

        SQLPLUS SCOTT/TIGER _at_SCRIPT.SQL PARAM1

where the value in 'PARAM1' is used for &1. But if the user has not typed in 'PARAM1' how can you test for this in the 'script' without SQL*PLUS 'asking' for &1?

What I want to do is to be able to run a script with a param (eg. to sort by a particular column) or if I don't give a parameter to use a particular column to sort on by default.

I Tried using a construct like (nvl('&1','default')) but SQL*PLUS stills wants a null reply to &1 before it will use 'default' eg. in a decode statement.

(I would prefer a SQL*PLUS script which can be STARTable from within SQL*PLUS rather than a 'here is' unix script)

Lez

-- 
Lez Oxley, Administration, University of Sussex, Brighton, BN1 9RH, UK
Tel: +44 273 606755 x3808 Fax: +44 273 678335 JANET: lezo_at_uk.ac.sussex.syma
ARPA: lezo%syma.sussex.ac.uk_at_nsfnet-relay.ac.uk
BITNET: lezo_at_syma.sussex.ac.uk      UUCP: lezo_at_syma.uucp
Received on Tue May 19 1992 - 11:45:01 CEST

Original text of this message