Saturday, 15 June 2013

plsql - User-defined function with IN VARCHAR parameter in PL/SQL Oracle -


I need some help. This is the first time I am asking for help here, so please forgive me for my bad English Please. I am very mad, because I did not know how to correct this error. The output I work in Oracle 10g is:

  Function was created. no errors. Enter the value for the V_numes created: 'SECTIA1' - SECTIA1 is the name of the segment (department), Secti Table Sequoia is in existence Baja Day Date SECTIA1 Newamale Sector This: SECTIA1 - Department name (v_numes) DECLARE * Error on line 1 : Ora-06502: PL / SQL: Numeric or Value Error: Character Ora-06512 for Number Conversion Error: On "SYSTEM.FUNCTION0", Line 18 ORA-01403: No Data Found ORA-06512: On Line 17   

Here is my code:

  Server Output on the Set Set verify off or function function F02 (p_section_name VARCHAR) returns the number v_procent1 CONSTANT REAL: = 0.01; V_cods sectii.cods% TYPE; - The name of the table is currently, which means section v_ok1 NUMBER: = 1; BEGIN DBMS_OUTPUT.PUT_LINE ('Numail secti is:' || P_section_name); Selection code in v_cods from SECTII, where = = UPPER (p_section_name); DBMS_OUTPUT.PUT_LINE ('Kodal Sectini Pantu' || P_section_name || 'this' || Wikodes); Returns (v_ok1); Exception when TOO_MANY_ROWS is back then 'Prea multe sectii cu acest nume.'; WHEN NO_DATA_FOUND again 'get out of the blank.'; When others RAISE_APPLICATION_ERROR (-20011, 'Unknown exception function'); END function 0; Show / Error; / DECLARE v_numes VARCHAR2 (255); V_numesu VARCHAR2 (255); V_numesl VARCHAR2 (255); V_boool number: = 1; E_invalid_section exception; BEGIN v_numes: = & amp; V_numes; If SQL% generates non-fond, e_invalid_section; ELSE DBMS_OUTPUT.PUT_LINE ('Sequia existent date in date' 'v_numes); end if; V_numesu: = upper (v_numes); V_numesl: = low (v_numes); If v_numes = v_numesl or v_numes = v_numesu then DBMS_OUTPUT.PUT_LINE ('FUNCTION0' || function0 (v_numes)); end if; --v_numes: = TO_CHAR (v_numes); --DBMS_OUTPUT.PUT_LINE ('ReturnFinetEye 0:' || v_boool); Exception when e_invalid_section then - defined by the user using DBMS_OUTPUT.PUT_LINE ('There is a new group in new content'); End;       

FUNCTION0 declaration indicates that the return number is returned << / code>

Returns the return statement letters in your exception block ... / Exception when P>

  TOO_MANY_ROWS then back to 'Prea multe sectii cu acest nume.';; '; WHEN NO_DATA_FOUND again 'get out of the blank.';   

One thing is worth noting, your error was very specific:

  error in line 1: ORA-066502: PL / SQL: numeric or value Error: Number conversion error for character ORA-06512: "SYSTEM.FUNCTION0", line 18 ORA-01403: no data found ORA-06512: on line 17   

it means That you are converting a letter to a number on line 18 and a NO_DATA_FOUND exception was raised on line 17 ...

All of your comments To answer in one place, you are getting NO_DATA_FOUND exception due to the WHERE clause, as I have already said.

  WHERE den = UPPER (p_section_name)   

Run this selection statement:

 from  select * code where = Upper (den)   

This will not return any lines because it is not true. If you are overwriting the p_section_name parameter, then you also need to uppercase the column den you need to do case-insensitive search, see for more information.

No comments:

Post a Comment