Results 1 to 6 of 6

Thread: PL\SQL query

  1. #1
    Join Date
    Mar 2013
    Posts
    11

    Unanswered: PL\SQL query

    I have made two functions in one function but there is problem in syntax
    please just tell me what is the wrong
    I'm beginner :'( :
    Code:
    CREATE OR REPLACE FUNCTION check_email(Email IN VARCHAR2)
              RETURN VARCHAR2 IS
                e_length NUMBER(2); -- the email length.
                email_e varchar2(30);  -- to insert in to it the email extention.
                email_c varchar2(30);  -- to insert in to it the correct email.
              BEGIN
                e_length := instr(Email,'@');
                IF (e_length <4 )  THEN
                  RETURN 'the email under allowable range';
                elsIF
                  email_c := substr(Email,0,instr(Email,'@',1)-1) ; 
                  select substr(Email,instr(Email,'@',1,1)) 
                  into email_e from dual ;
                    if email_e <> '@edexcel.com' 
                    then email_e :='@edexcel.com' ;
                RETURN 'We added edexcel.com extention to you email';
                else
                Return 'The email is correct';
                end if;
              END;
    Last edited by Pat Phelan; 03-25-13 at 19:57. Reason: Added tags per Littlefoot request

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    OK, so you have written a function and got an error. Which error was it?

    Please, format your code and use [code] tags to preserve formatting; the above code is unreadable.

    I see that the first ELSIF misses THEN keyword. There might be other errors, though; we'd spot them easier if you, as I said, formatted the code.

  3. #3
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    every IF requires an END IF
    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.

  4. #4
    Join Date
    Mar 2013
    Posts
    11
    Thanks so much I've did it

  5. #5
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >Thanks so much I've did it

    Do you still have syntax errors?
    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.

  6. #6
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    When you compile code under sqlplus if you have an error simply type SHOW ERRORS and it will display where the errors were and what they are.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Posting Permissions

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