Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2014
    Posts
    1

    Unanswered: procedure failed

    create or replace procedure "CREATE_U"
    is
    begin
    SELECT CONCAT(EMPLOYEE_NUMBER, IRC_#) INTO UNIQUE_ID
    FROM ORS;
    end;​

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    we don't have your table or data so we can't run your code.
    we don't know what error you got.

    what datatype is "UNIQUE_ID"?
    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.

  3. #3
    Join Date
    Dec 2007
    Posts
    253
    Quote Originally Posted by vinod2802 View Post
    create or replace procedure "CREATE_U"
    is
    begin
    SELECT CONCAT(EMPLOYEE_NUMBER, IRC_#) INTO UNIQUE_ID
    FROM ORS;
    end;​
    Yeah, failed for me too. I don't have a table called ors. What's your reason?

    Here's one that fails fo me too
    insert into xyz values(2);

    Totally fails. Nightmare man.

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Apart from other possible reasons, it most probably failed because UNIQUE_ID isn't declared.
    Code:
    create or replace procedure create_u is
      -- You'll know how large the result of the concatenation is; 
      -- I'm just guessing.
      unique_id varchar2(100);     
    begin
      SELECT CONCAT(EMPLOYEE_NUMBER, IRC_#) 
      INTO UNIQUE_ID
      FROM ORS;
    end;​
    Note that this code will compile, but might fail when you execute it. Possible failures are TOO-MANY-ROWS (if the ORS table contains more than 1 record) or NO-DATA-FOUND (if it contains no records), so you'll have to do something - handle exceptions, apply WHERE clause, one of aggregate functions (MAX, MIN) or whatever you find appropriate.

Tags for this Thread

Posting Permissions

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