how to use select clause in assignment

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • joy

    how to use select clause in assignment

    I am writting a procedure, i am using a table:
    part(empno,..., partid,..). I already know the partid, and I need to
    know empno so I can use it to invoke another procedure--like
    empb(myid). part of the code like:
    myid =
    (select empno
    from part
    where partid = part_id;);
    and I started the procedure, it gave me:
    15/16 PLS-00103: Encountered the symbol "SELECT" when expecting one
    of
    the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier<a bind variableavg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number<a single-quoted SQL stringpipe

    17/39 PLS-00103: Encountered the symbol ")"
    what should I do? Thanks for help!
  • mcstock

    #2
    Re: how to use select clause in assignment

    look in the first chapter of the PL/SQL Users Guide under 'Assigning Values
    to Variables''

    you need to user the SELECT INTO syntax

    -- mcs

    "joy" <joyfoely@yahoo .comwrote in message
    news:357eb048.0 311211928.6d864 16e@posting.goo gle.com...
    | I am writting a procedure, i am using a table:
    | part(empno,..., partid,..). I already know the partid, and I need to
    | know empno so I can use it to invoke another procedure--like
    | empb(myid). part of the code like:
    | myid =
    | (select empno
    | from part
    | where partid = part_id;);
    | and I started the procedure, it gave me:
    | 15/16 PLS-00103: Encountered the symbol "SELECT" when expecting one
    | of
    | the following:
    | ( - + case mod new not null others <an identifier>
    | <a double-quoted delimited-identifier<a bind variableavg
    | count current exists max min prior sql stddev sum variance
    | execute forall merge time timestamp interval date
    | <a string literal with character set specification>
    | <a number<a single-quoted SQL stringpipe
    |
    | 17/39 PLS-00103: Encountered the symbol ")"
    | what should I do? Thanks for help!


    Comment

    • Christine

      #3
      Re: how to use select clause in assignment

      like this,

      EXECUTE IMMEDIATE 'select empno from part where partid = '||part_id into myid;

      Comment

      • Frank

        #4
        Re: how to use select clause in assignment

        Christine wrote:
        like this,
        >
        EXECUTE IMMEDIATE 'select empno from part where partid = '||part_id into myid;
        Use BIND variables:
        EXECUTE IMMEDIATE 'select empno from part where partid = :a'
        using part_id
        into myid;
        --
        Regards, Frank van Bortel

        Comment

        Working...