Results 1 to 4 of 4

Thread: select

  1. #1
    Join Date
    Sep 2003
    Posts
    7

    Unanswered: select

    Hi all,

    I need to perform the following sentence

    select flag_id from t_flags where name = sFlag;

    in a plsql function, where sFlag is a parameter or type VARCHAR2.

    How can I perform that?

    The complete code looks like that:

    function checkflag (sFlag varchar2) return number is
    iflag number(10);

    begin
    select flag_id from t_flags where name = sFlag;
    return flag_id;
    end;

    Thank you for your time;

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

    Lightbulb

    Try this:

    Code:
    
    function checkflag (sFlag varchar2) return number is
    iflag number(10);
    
    begin
    select flag_id into iflag
    from t_flags where name = sFlag;
    return iflag;
    end;
    
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Sep 2003
    Posts
    7
    Originally posted by LKBrwn_DBA
    Try this:

    Code:
    
    function checkflag (sFlag varchar2) return number is
    iflag number(10);
    
    begin
    select flag_id into iflag
    from t_flags where name = sFlag;
    return iflag;
    end;
    
    Thank you for your answer.

    Yes, I think that I misstake copying the sentence. That sentence is part of the real code, but that is the sentence that fails.

    The problem is in the comparision 'name = sFlag'
    Perhaps do I need to perform the comparision with another operator?. Or perhaps I'm missing the sintaxis.

  4. #4
    Join Date
    Sep 2003
    Posts
    7

    Re: select

    Ok, the problem was with the name ot the table.
    In that system there are two tables with similar names and with some columns in common, so there were no syntax error.

Posting Permissions

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