Re: if else logic in SQLPlus scripts
From: Daniel Morgan <dmorgan_at_exesolutions.com>
Date: Fri, 20 Sep 2002 20:54:15 GMT
Message-ID: <3D8B8AF1.EC93ACF6_at_exesolutions.com>
Date: Fri, 20 Sep 2002 20:54:15 GMT
Message-ID: <3D8B8AF1.EC93ACF6_at_exesolutions.com>
Steve Mitchell wrote:
> I know I saw a treatment of this someplace on the web, but I cannot find it
> now that I look for it.
>
> I would like to do some simple if/then/else logic from within my SQL plus
> scripts.
>
> Does anybody have any examples of this?
>
> Thanks.
>
> --steve
SET SERVEROUTPUT ON DECLARE i PLS_INTEGER;
BEGIN
SELECT COUNT(*)
INTO i
FROM all_tables;
IF i > 100 THEN
DBMS_OUTPUT.PUT_LINE('There Are More Than 100 Tables');
ELSE
DBMS_OUTPUT.PUT_LINE('There Are Less Than 100 Tables');
END IF;
END;
/
Daniel Morgan Received on Fri Sep 20 2002 - 22:54:15 CEST
