Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Posts
    276

    Unanswered: select inside a procedure

    Will I be able to do a simple select inside a procedure like below-

    procedure test
    begin
    select * from test_table;
    end;

    or should the select always have an into clause like below -

    procedure test
    begin
    select abc from test_table
    into abd;
    end;

    I'll appreciate any input on this.

    Thanks,
    Nandinir

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Cool Into

    Inside a procedure you need the INTO clause.
    Code:
    abc varchar2(10);
    BEGIN
      SELECT col1 INTO abc
         FROM MyTable;
    END;
    /

    PS: I recommend you actually READ the fine Oracle® Database PL/SQL User's Guide and Reference manual.
    .
    Last edited by LKBrwn_DBA; 07-02-09 at 16:01.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >SELECT col1 INTO abc FROM MyTable;
    Use of syntax above limits rows returned to 1.
    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.

Posting Permissions

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