DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: SQLPLUS if then

Threaded View

  1. #3
    Join Date
    Mar 2007
    Location
    Ft. Lauderdale, FL
    Posts
    3,555
    Quote Originally Posted by mnymoen
    I am able to get the results through PL/SQL below but I am not sure how to pass that variable to sqlplus.
    DECLARE x varchar(25) := 'A';
    y varchar(30);
    BEGIN
    SELECT DECODE(x,
    'A', 'WHERE test_column > 5',
    'B', 'WHERE test_column > 500',
    'C', 'WHERE test_column < 5')
    INTO y
    FROM DUAL;
    select disc_Cd from disc y;
    END;
    /
    select disc_Cd from disc y
    No. You are not.
    Last edited by PAVB; 08-22-2008 at 05:22 AM.
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width