Home » SQL & PL/SQL » SQL & PL/SQL » Last line truncated (Oracle 10g)
Last line truncated [message #311842] Mon, 07 April 2008 02:24 Go to next message
sitangshu
Messages: 2
Registered: April 2008
Location: New Delhi
Junior Member

I have written this pl/sql code but getting an error in last line while executing.
line 24 truncated which is the last line -- END;
Also, it is not showing the semicolon after 'end'
i applied two semicolons, but even then the error is not solved.
can anyone please help.
-------------------------------------------------------
DECLARE
EMPID EMPLOYEES.EMP_ID% TYPE;
EMPNAME EMPLOYEES.EMP_NAME% TYPE;
DATE_OF_BIRTH EMPLOYEES.DOB% TYPE;
DEPARTMENT EMPLOYEES.DEPT% TYPE;
REPORTING_OFFICER EMPLOYEES.REPORT_TO% TYPE;
DATEOF_JOIN EMPLOYEES.DATE_OF_JOIN% TYPE;
EMPLOYEE_STATUS EMPLOYEES.EMP_STATUS% TYPE;
PROBATION_PERIOD EMPLOYEES.PROBATION% TYPE;
CURSOR INSERT_LEAVE_ACCOUNT IS SELECT EMP_ID, EMP_NAME, DOB, DEPT, REPORT_TO, DATE_OF_JOIN, EMP_STATUS, PROBATION FROM EMPLOYEES;
BEGIN
OPEN INSERT_LEAVE_ACCOUNT;
LOOP
FETCH INSERT_LEAVE_ACCOUNT INTO EMPID, EMPNAME, DATE_OF_BIRTH, DEPARTMENT, REPORTING_OFFICER, DATEOF_JOIN, EMPLOYEE_STATUS, PROBATION_PERIOD;
IF EMPLOYEE_STATUS = 1 THEN
INSERT INTO LEAVE_ACCT VALUES (LEAVE_ACCT_SEQ.NEXTVAL, EMPID, 10, SYSDATE, 10, SYSDATE, 30, SYSDATE);
ELSE IF EMPLOYEE_STATUS = 2 THEN
INSERT INTO LEAVE_ACCT VALUES (LEAVE_ACCT_SEQ.NEXTVAL, EMPID, 10, SYSDATE, 0, SYSDATE, 0, SYSDATE);
END IF;
END IF:
DBMS_OUTPUT.PUT_LINE ('UPDATED SUCCESSFULLY');
END LOOP;
CLOSE INSERT_LEAVE_ACCOUNT;
COMMIT;
END;
Re: Last line truncated [message #311843 is a reply to message #311842] Mon, 07 April 2008 02:27 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Use SQL*Plus, copy and paste what you did, don't forget to read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter) and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel

Re: Last line truncated [message #311845 is a reply to message #311842] Mon, 07 April 2008 02:28 Go to previous messageGo to next message
dr.s.raghunathan
Messages: 540
Registered: February 2008
Senior Member
hi,
surprised. error is not coming for me..
yours
dr.s.raghunathan
Re: Last line truncated [message #311848 is a reply to message #311845] Mon, 07 April 2008 02:37 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
@dr.s.raghunathan
Quote:
surprised. error is not coming for me..

???

@sitangshu
Quote:
ELSE IF EMPLOYEE_STATUS = 2 THEN

you have to use ELSIF nd not ELSEIF.


regards,

Re: Last line truncated [message #311851 is a reply to message #311848] Mon, 07 April 2008 02:41 Go to previous messageGo to next message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
dhananjay wrote on Mon, 07 April 2008 08:37

@sitangshu
Quote:
ELSE IF EMPLOYEE_STATUS = 2 THEN

you have to use ELSIF nd not ELSEIF.



He used ELSE IF and not ELSEIF and two end ifs, syntactically coeerct (maybe not the 'normal' way to do it tho')
Re: Last line truncated [message #311854 is a reply to message #311851] Mon, 07 April 2008 02:49 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
My Apologize ,should have read OP's post carefully.

regards,
Re: Last line truncated [message #311857 is a reply to message #311854] Mon, 07 April 2008 02:52 Go to previous messageGo to next message
dhananjay
Messages: 635
Registered: March 2002
Location: Mumbai
Senior Member
Your 2nd END IF doesn't have a ';' .pls check.


regards,
Re: Last line truncated [message #311858 is a reply to message #311857] Mon, 07 April 2008 02:55 Go to previous message
pablolee
Messages: 2834
Registered: May 2007
Location: Scotland
Senior Member
Good spot!
Previous Topic: ddl for a role Plus role privs/grants
Next Topic: how to create dynamic spool
Goto Forum:
  


Current Time: Wed Dec 07 16:14:29 CST 2016

Total time taken to generate the page: 0.08537 seconds