Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Posts
    33

    Question Unanswered: Input parameter value while executing SQL

    Hi there,

    In oracle, if I run

    select * from employer where emplorer name like &EmpName;

    the system will prompt me to input the value for parameter 'EmpName'.

    Is there any way in DB2 I can do the same thing?


    Thanks,
    Jinsezh

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    I assume you mean in the CLP. THe answer is no.

    Andy

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    That does work with the QMF query tool for DB2 for z/OS (which I am sure is where Oracle stole it from). But it is not really the Oracle database engine, but the Oracle SQL+ interface that does that.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  4. #4
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    On unix or linux (or any OS where you can install and run bash) the following shell script does roughly what you want:
    Code:
    #! /bin/bash
    echo "Enter EmpName (may include '%' or '_' wildcards): \c"
    read EmpName
    db2 select \* from employer where employer_name like $EmpName
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  5. #5
    Join Date
    Aug 2006
    Posts
    33
    Thank you all.

    I found it in QMF, the query is exactly the same as in Oracle, the parameter also declares with &.

    Cheers,
    jinsezh

Posting Permissions

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