Results 1 to 6 of 6
  1. #1
    Join Date
    May 2008
    Posts
    4

    Unanswered: Passing parms to an If statement

    Hi All,
    I want to simply obtain a value from a user and then based on what the user entered invoke a simple describe.

    Attempted code:
    accept alias prompt "Enter the table alias: "
    Begin
    If &alias = 's15' then desc EMP_USER_S
    End;

    It doesn't seem to lke the "if" construct.
    Please advise. Thx in advance.
    RPrinceton

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >It doesn't seem to lke the "if" construct.
    Your assessment is 100% correct.
    SQL does not contain/support any IF statement.

    If you were willing or capable of Reading The Fine Manual, you'd have learned this fact on your own.

    http://download.oracle.com/docs/cd/B...b14200/toc.htm

    the whole Oracle documentation set can be found at http://tahiti.oracle.com

    Attempting to write code without referencing the Langauge Reference Manual is like trying to drive a car blindfolded.

    ENJOY!
    Last edited by anacedent; 05-07-08 at 20:44.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    May 2008
    Posts
    4

    Followup

    Antecedent,
    Thank you for you quick reply. If you google u_tab_data.sql it will point you to a script that uses IF/THEN/ELSE logic. I used it for a model prior to my question to the forum but I could not get the accepted variable introduced to the If/Then/Else construct of the Begin/End block and hence the question.
    Regards,
    RPrinceton

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    Sql<>pl/sql
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    sql - No if statements

    pl/sql - If statements, but no DESC statements

    See

    http://asktom.oracle.com/pls/asktom/...:1464804639878
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  6. #6
    Join Date
    May 2008
    Posts
    2
    RPrinceton,

    Looks like you want to write a anonymous PL/SQL block. Not a pure sql.
    Last edited by r937; 05-12-08 at 17:56.

Posting Permissions

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