Click here to Skip to main content
15,901,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

I have stored procedure in Oracle which is not getting compiled due to the following error:

The following error has occurred:
PROCEDURE STRL.SP_BEDOCC<br />
On line:  19<br />
PLS-00103: Encountered the symbol &quot;(&quot; when expecting one of the following:<br />
   ) varying large


Below is the line no 19 of my procedure
v_yearmonth := CAST(v_fin_year AS CHAR(4)) || v_month ;

v_month and v_yearmonth are of char type and v_fin_year is of number type. I need v_fin_year in 4 characters to concatnate it with v_month which is of 2 chars so that v_yearmonth is of 6 chars.

Can anybody let me know what could be the issue??

any help would be much appreciated.

Regards,
Gopal
Posted
Updated 15-Dec-10 23:18pm
v2

1 solution

Try using to_char instead, like:
to_char(v_fin_year, '9999')


Good luck!
 
Share this answer
 
Comments
gopalgupta 16-Dec-10 6:43am    
Thnx....that worked and the sp has compiled now.
But still it does not execute.

I am getting the below error while executing:
The following error has occurred:

ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "STRL.SP_BEDOCC", line 22
ORA-06512: at line 9

My sp till line 22 is as follows:
CREATE OR REPLACE PROCEDURE sp_bedocc
--exec sp_MISMonthlyBedPosting '15 may 2002','23 july 2002'
--sp_helptext sp_bedocc
--drop proc sp_bedocc

(
v_fin_year IN NUMBER DEFAULT NULL ,
v_month IN CHAR DEFAULT NULL
)
AS
--Exec sp_los @fin_year , @month
v_fn_yr Number(10,0);
v_yearmonth CHAR(6);
v_yr NUMBER(10,0);
v_temp NUMBER(1, 0) := 0;


BEGIN

v_yr := v_fin_year ;
v_fn_yr := v_fin_year ;
v_yearmonth := TO_CHAR(v_fin_year,'9999') || v_month ;
E.F. Nijboer 16-Dec-10 7:31am    
You seem to be working with the char datatype and to_char returns VARCHAR2.
reference: http://psoug.org/reference/convert_func.html
gopalgupta 18-Dec-10 3:48am    
thnx man...its working fine now...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900