Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2008
    Posts
    16

    Unanswered: Parameter Passing In Db2

    this is the way in oracle to ask a user to pass a required value
    select ename from emp where mgr=&12;
    output will be:
    Enter value for 12: 7788
    old 1: select ename from emp where mgr=&12
    new 1: select ename from emp where mgr=7788

    ENAME
    ----------
    ADAMS
    so how do we do this in DB2
    "TALK SENSE TO FOOL. HE CALLS U FOOLISH"

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You write a shell/Perl/Python/... script that does the I/O that and then the script executes SQL statements. There is rarely the need to invent another language/extension for that.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Apr 2008
    Posts
    39
    You can write one scalar UDF where you can pass mgr value as input parameter and return ename as output.

    Thanks,
    Madhavi

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    I understood the question in such a way that the '&12' syntax actually triggers a user-interaction over the console and the user has to enter some value there.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  5. #5
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    same syntax exists in QMF.

  6. #6
    Join Date
    Sep 2008
    Posts
    16
    Yes,i would require an output as Mr.STOLZE mentioned
    "TALK SENSE TO FOOL. HE CALLS U FOOLISH"

Posting Permissions

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