ORA-06521: PL/SQL: Error mapping function
Hi folks,
I am trying to run gather_table_stats for a particular table but am getting the below error. Any ideas?
SQL> execute DBMS_STATS.gather_table_stats( ownname=>'DBO',tabname=>'CD_JOURNAL_CHANGE_REG',method_opt=>'FOR ALL INDEXED COLUMNS',cascade=>TRUE);
BEGIN DBMS_STATS.gather_table_stats( ownname=>'DBO',tabname=>'CD_JOURNAL_CHANGE_REG',method_opt=>'FOR ALL INDEXED COLUMNS',cascade=>TRUE); END;
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06512: at "SYS.DBMS_STATS", line 10301
ORA-06512: at "SYS.DBMS_STATS", line 10315
ORA-06512: at line 1
I have runt utlrp.sql as sys but with no avail.
Kindest Regards,
Will
You did not mention if the applicable table contains an ADT columns, nested tables and so on.
You can also do a basic test to determine if the problem is potentially with the table, or with dbms_stats itself. Create a plain table, e.g.
create table foo( id number, foo_char varchar2(100), constraint pk_foo primary key( id ) using index );
Using the exact same dbms_stats parameters, do this table. If it works, it points to a potential problem with the other table - some data structure/data type issue maybe. If it does not, then you have a problem with dbms_stats itself.
You can also drop the indexes on the DBO table and try dbms_stats with different parameters. I.e. change the conditions to see if the error still occur in order to isolate the problem.
You also could log an iTar/SR for this with Oracle Support.
Similar Messages
-
We have an external procedure running fine on 8.1.7 on VMS. After compiling and linking succesfully under 10.1.0, I get ORA-06521 PL/SQL: Error mapping function and ORA-06522: ERROR - vms_dlsym for file x, where x in the filename of the linked executable. Another external procedure that does not connect to the 10.1.0 database runs fine. What could be causing this error in Server 10.1.0 on VMS?
Thanks,
DaveHere is the code to create the function:
CREATE OR REPLACE FUNCTION f1
(h_file_name IN VARCHAR2)
RETURN BINARY_INTEGER
IS EXTERNAL
LIBRARY l1
NAME "f1"
LANGUAGE C
WITH CONTEXT
PARAMETERS
(CONTEST,
h_file_name string);
Here is the beginning of the Pro*C:
int f1(epctx, h_file_name)
OCIExtProcContext *epctx;
char h_file_name[70];
char h_line_txt [251];
int lineno;
FILE *fptr;
/* register the connection context ... */
EXEC SQL REGISTER CONNECT USING :epctx;
The function loads a flat file into the database. It is probably not related but are unable to SQLPLUS/ or SQLLDR/ into the database from an OS autheniticated account (get ORA-12547: TNS:lost contact.) Thanks for taking the time to look at this. There aren't many people trying this on VMS, I'd bet. -
Hi,
I am getting the following error :
SQL> select MinDistance(TT) from egg1;
select MinDistance(TT) from egg1
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
undefined symbol: ODCIAggregateInitialize
I am compiling my C program with OCI using the following command :
g++ -Wall -c custagg.c -o custagg.o -I$ORACLE_HOME/rdbms/public -I/usr/lib
I am linking to get a shared library custagg.so file with following command :
ld -shared -o custagg.so custagg.o $ORACLE_HOME/lib/l*.so ../../usr/lib/libstdc++.s*
I am not getting any errors during these two phases.
And when i am calling the extproc custagg(Mindistance) which i implemented using ODCI(oracle data catridge interface) ...I am getting the error undefined symbol : ODCIAggregateInitialize
So can any one please let me know what shared libraries are required to access the ODCI services and also am I compiling and linking it the right way or am I missing any libraries.
I have the oci.h & odci.h and several other header files in my :
$ORACLE_HOME/rdbms/public
And while linking i am using : $ORACLE_HOME/lib/*.so files.
So I don't know whether my directory is missing some shared files related to ODCI : can any one please let me know which files or shared libraries I am missing :
Below are list of files in my : $ORACLE_HOME/lib :
custagg123.o libclntsh.so libdbcfg10.so libjox10.so libocci.so.10.1 liborasdkbase.so libskgxpd.so libunwind.so.5
custagg.so libclntsh.so.10.1 libemmas10.so libldapjclnt10.so libocijdbc10.so liborasdkbase.so.10.2 libskgxpu.so libxdb.so
facility.lis libclsra10.so libhasgen10.so libnjni10.so libocr10.so liborasdk.so libsqlplus.so shell.so
hsdb_odbc.so libcorejava.so libheteroxa10.so libnjssl10.so libocrb10.so liborasdk.so.10.2 libsqora.so.10.1 sysliblist
hsdb_ora.so libcoresh10.so libhsbase.so libnnz10.so libocrutl10.so libqsmashr.so libsrvm10.so
lclasses12.zip libcprts.so.5 libhsnav.so libnque10.so libodm10.so libskgxn2.so libsrvmhas10.so
libagtsh.so libcxa.so.3 libimf.so libntcpaio10.so libodmd10.so libskgxns.so libsrvmocr10.so
libagtsh.so.1.0 libcxa.so.5 libirc.a libocci.so libons.so libskgxp10.so libuini10.so
Please reply to my queries.
Please let me know if you want to have a look at the symbols of my object file
Thanks & Regards,
-NNYour issue may relate to XE and it may relate to OCI but it does not relate to SQL and PL/SQL. Consider posting your question in a forum where it will be on topic.
When you do include full version information (3 decimal places) and the code that is generating the exception. -
Hi,
I am getting the following error :
SQL> select MinDistance(TT) from egg1;
select MinDistance(TT) from egg1
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06522: /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/lib/custagg.so:
undefined symbol: ODCIAggregateInitialize
I am compiling my C program with OCI using the following command :
g++ -Wall -c custagg.c -o custagg.o -I$ORACLE_HOME/rdbms/public -I/usr/lib
I am linking to get a shared library custagg.so file with following command :
ld -shared -o custagg.so custagg.o $ORACLE_HOME/lib/l*.so ../../usr/lib/libstdc++.s*
I am not getting any errors during these two phases.
And when i am calling the extproc custagg(Mindistance) which i implemented using ODCI(oracle data catridge interface) ...I am getting the error undefined symbol : ODCIAggregateInitialize
So can any one please let me know what shared libraries are required to access the ODCI services and also am I compiling and linking it the right way or am I missing any libraries.
I have the oci.h & odci.h and several other header files in my :
$ORACLE_HOME/rdbms/public
And while linking i am using : $ORACLE_HOME/lib/*.so files.
So I don't know whether my directory is missing some shared files related to ODCI : can any one please let me know which files or shared libraries I am missing :
Below are list of files in my : $ORACLE_HOME/lib :
custagg123.o libclntsh.so libdbcfg10.so libjox10.so libocci.so.10.1 liborasdkbase.so libskgxpd.so libunwind.so.5
custagg.so libclntsh.so.10.1 libemmas10.so libldapjclnt10.so libocijdbc10.so liborasdkbase.so.10.2 libskgxpu.so libxdb.so
facility.lis libclsra10.so libhasgen10.so libnjni10.so libocr10.so liborasdk.so libsqlplus.so shell.so
hsdb_odbc.so libcorejava.so libheteroxa10.so libnjssl10.so libocrb10.so liborasdk.so.10.2 libsqora.so.10.1 sysliblist
hsdb_ora.so libcoresh10.so libhsbase.so libnnz10.so libocrutl10.so libqsmashr.so libsrvm10.so
lclasses12.zip libcprts.so.5 libhsnav.so libnque10.so libodm10.so libskgxn2.so libsrvmhas10.so
libagtsh.so libcxa.so.3 libimf.so libntcpaio10.so libodmd10.so libskgxns.so libsrvmocr10.so
libagtsh.so.1.0 libcxa.so.5 libirc.a libocci.so libons.so libskgxp10.so libuini10.so
Please reply to my queries.
Please let me know if you want to have a look at the symbols of my object file
Thanks & Regards,
-NNIt's only a quick guess but have you checked your tnsnames.ora file to ensure you've opened the environment to find the libraries? If you set the EXTPROC_DLLS=ANY, you open the database to security issues but it should tell you if this cause because you can't access the library that contains the symbol.
SID_LIST_CALLOUT_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = <oracle_home_directory>)
(PROGRAM = extproc)
(ENV = "EXTPROC_DLLS=ONLY:
<oracle_home_directory>/customlib/writestr1.so
,LD_LIBRARY_PATH=<oracle_home_directory>/lib")
) -
ORA-06521: PL/SQL: Error mapping function while writting into a text file
Hi,
I'm getting an errror ORA-06521: PL/SQL: Error mapping function while trying to write data into a text file.
I'm using the following code:
--To create a new directory
create or replace directory temp as 'C:/temp';
declare
l_str varchar2(1000);
output_file utl_file.file_type;
cursor test_write_cur is
select EMPNO,ENAME,JOB,SAL,HIREDATE
from EMP
where DEPTNO=30;
begin
output_file := utl_file.fopen('TEMP','TESTFILE.txt','w');
for test_write_rec IN test_write_cur
loop
l_str := test_write_rec.EMPNO||'^'||test_write_rec.ENAME||'^'||test_write_rec.JOB||'^'||
test_write_rec.HIREDATE||'^'||test_write_rec.SAL||chr(10);
utl_file.put_line(output_file,l_str);
end loop;
utl_file.fclose(output_file);
end;Please suggest me if i'm wrong.
Thanks & Regards,
Sanket MishraDear Sanket,
I think you are need use TO_CHAR() function
to_char(test_write_rec.EMPNO) ,
to_char(test_write_rec.HIREDATE,'DD.MM.YYYY')
to_char(test_write_rec.SAL) -
Call to ldap server fails ORA-06521: PL/SQL: Error mapping function
I am getting this error(s)
ORA-06521: PL/SQL: Error mapping function
ORA-06512: at "SYS.DBMS_LDAP_API_FFI", line 0
ORA-06512: at "SYS.DBMS_LDAP", line 1338
ORA-06512: at "SYS.DBMS_LDAP", line 1273
ORA-06512: at "SYS.DBMS_LDAP", line 529
ORA-06512: at line 127
after binding and searching an ldap directory.
Line 127 is:
my_dn := DBMS_LDAP.get_dn(my_session, my_entry);
Both of the 'my_xx' parameters have been successfully set earlier in the script I believe as they produce no errors and DBMS_LDAP.count_entries(my_session, my_message) returns = 1.
I am following the example at:
http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96577/smplcode.htm#636994
In fact any of the functions used in the 'while loop' in the above example give a similar error.
Apparently SYS.DBMS_LDAP_API_FFI is a call to an external C program, but this would be a standard Oracle one, not one I have written.
I am connecting to a non-Oracle ldap server, and have tried several (OpenLDAP 2.X, & Windows 2000 AD), with same results.
Any suggestions gratefully received.
Cheers
KIMFixed by running the catldap.sql script (ORACLE_HOME/rdbms/admin/catldap.sql) as SYS user and recreated the dbms_ldap packages. I am not sure why some of the functions worked OK and others did not.
KIM -
Ldap problem, ORA-06521: PL/SQL: Error mapping function
I am getting this error(s)
ORA-06521: PL/SQL: Error mapping function
ORA-06512: at "SYS.DBMS_LDAP_API_FFI", line 0
ORA-06512: at "SYS.DBMS_LDAP", line 1338
ORA-06512: at "SYS.DBMS_LDAP", line 1273
ORA-06512: at "SYS.DBMS_LDAP", line 529
ORA-06512: at line 127
after binding and searching an ldap directory.
Line 127 is:
my_dn := DBMS_LDAP.get_dn(my_session, my_entry);
Both of the 'my_xx' parameters have been successfully set earlier in the script I believe as they produce no errors and DBMS_LDAP.count_entries(my_session, my_message) returns = 1.
I am following the example at:
http://download-west.oracle.com/docs/cd/B10501_01/network.920/a96577/smplcode.htm#636994
In fact any of the functions used in the 'while loop' in the above example give a similar error.
Apparently SYS.DBMS_LDAP_API_FFI is a call to an external C program, but this would be a standard Oracle one, not one I have written.
I am connecting to a non-Oracle ldap server, and have tried several (OpenLDAP 2.X, & Windows 2000 AD), with same results.
Any suggestions gratefully received.
Cheers
KIMScott,
Thanks for your concern. I should have explained. I am working in HTMLdb, successfully using ldap to authenticate, but now need to get the logged-in user's name and other details. All my attemps to use the wwv_flow_ldap functions have failed, and I am no resorting to DBMS_LDAP to get what I want. I am hoping thatsome helpful person can shed some light on this problem
Cheers
KIM -
DBMS_LDAP call fails with ORA-06512 Error Mapping function
Hi,
I am facing a problem with workflow integration with LDAP.
I receive
ORA-6512 Error Mapping Function on one particular line within the WF_LDAP.get_cfg_val procedure.
WHILE my_entry IS NOT NULL
LOOP
my_vals := DBMS_LDAP.get_values (p_session,
my_entry,
p_name);
The documentation says:
ORA-06521 PL/SQL: Error mapping function
Cause: An error was detected by PL/SQL trying to map the mentioned
function dynamically.
Action: Check the stacked error (if any) for more details.
This is the trace of the error:
ORA-06521 PL/SQL Error mapping Function
ORA-06512 at SYS.DBMS_LDAP_API_FFI line 0
ORA-06512 at SYS.DBMS_LDAP line 1332
ORA-06512 at SYS.DBMS_LDAP line 1302
ORA-06512 at SYS.DBMS_LDAP line 582
This is the header of the catldap.sql file
Rem
Rem $Header: catldap.sql 07-jan-2000.19:15:20 akolli Exp $
Rem
Rem catldap.sql
Rem
Rem $Header: dbmsldap.sql 14-dec-2001.23:25:22 rbollu Exp $
Rem
Rem dbmsldap.sql
Rem
This is the output while running it (No errors):
Library created.
Package created.
Package created.
Package created.
Package body created.
Package body created.
Package body created.
Synonym created.
Grant succeeded.
Synonym created.
Grant succeeded.
Database is :
compatible 9.2.0.0.0
Am I missing something?
I have searched all the forums and although there are many references to "Error Mapping Function", noone has reported it in the context of WF - LDAP Integration. So I am not sure how to proceed.
Please help.
thanks in advance,
LibinHi Libin,
Can you please explain to me the parameters that you put in the Global Preferences, the LDAP_port,LDAP_user,and the others, because I don�t know where I need to search in the server this parameters and I don�t understand su much of OID.
if you can give to me and little description of that parameters,this would thank for much.
anticipated thanks
Arlet -
ORA-06502: PL/SQL error with dimensions and roles
Hi everyone,
When executing a mapping that loads a cube we are always getting that ORA-06502: PL/SQL error character string buffer too small
The cube contains a number of dimensions, some of them with roles. We've checked that the error appears when we use two different lookup operators to fill dimension atributtes in the cube and its correspondent role. If we map dimension attributes with lookup operator, and the role attributes with constants, the mapping executes without any error. Moreover, even thought it doesnt make any sense, if we map the role dimension attributes with a lookup operator linked to a different dimension, it works too.
We think that this could be due to attributes names, maybe they are too long, but we have tried to make them shorter and still getting the same error.
Any ideas of what could be happening?
Thank you so much in advance.The return datatype in a PLSQL function is unconstrained. Which means it does not have a size.
The size is declared on the receiving end.
What size variable are you trying to return your value into?
Here is an example...
SQL>create or replace function my_func
2 return varchar2
3 is
4 begin
5 return USER;
6 end;
7 /
Function created.
SQL>declare
2 my_string varchar2(30);
3 begin
4 my_string := my_func;
5 end;
6 /
PL/SQL procedure successfully completed.
SQL>declare
2 my_string varchar2(3);
3 begin
4 my_string := my_func;
5 end;
6 /
declare
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 4 -
Hi All,
I've created a library and mapped it to the operating system directory(UNIX/AIX), and created a procedure that calls my C program through pl/sql, but I keep getting error
message (06521)Error mapping function. I have void datatype return values from my C program no calling parameters and it does return data when executed by itself. I've tested the directory path that I defined in my create library statement and, I believe It's reaching the C program in the said directory, but I recieve no data through the pl/sql program. TM states, as of oracle8 we can access external C,pascal,etc.. files.I'm assuming that this access can be achieved programmatically.
Am I overlooking something?
Thank you very much for your help!!<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Pankaj Choudhery ([email protected]):
parameters are not the same in pl/sql & C function<HR></BLOCKQUOTE>
Thanks for your reply Panka,
I think you're right there on the problem.
I too believe that the problem lies between the conversion of the datasources between the two languages.
I'm using oracle8's default external procedure datatype,to bridge the gap between the pl/sql code and the C parameters. By the Book its -- Varchar2(plsql) = STRING(external type) = C program(*char)...etc. There seems to be more to it than the book is explaining would you perhaps know of any other documentation sources?
Thanks again... -
ORA-06502: PL/SQL: error TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;
Hi,
I've a Compiled Body Package which code I described below:
create or replace
PACKAGE body emp_pkg
IS
TYPE boolean_tabtype2
IS
TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;
valid_jobs boolean_tabtype2;
PROCEDURE add_employee(
first_name employees.first_name%TYPE,
last_name employees.last_name%TYPE,
deptid employees.department_id%TYPE,
jobid employees.job_id%type)
IS
BEGIN
IF valid_deptid(deptid) THEN
if valid_jobid(jobid) then
INSERT
INTO employees
employee_id,
first_name,
last_name,
email,
hire_date,
job_id,
department_id
VALUES
employees_seq.NEXTVAL,
first_name,
last_name,
SUBSTR(first_name,1,1)
||SUBSTR(last_name,1,7)
||'@buongio.com',
sysdate,
'SA_REP',
deptid
ELSE
RAISE_APPLICATION_ERROR (-20204, 'Invalid job ID. Try again.');
END IF;
END add_employee;
PROCEDURE init_jobs
is
begin
FOR rec IN
(SELECT job_id FROM jobs
LOOP
valid_jobs(rec.job_id):=true;
END LOOP;
END init_jobs;
function valid_jobid(
jobid employees.job_id%type)
return boolean
is
BEGIN
return valid_jobs.exists(jobid);
EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line('no valid');
RETURN FALSE;
END valid_jobid ;
BEGIN
init_jobs;
END emp_pkg;and the server gives me the next output
ORA-06502: PL/SQL: error : error de conversión de carácter a número numérico o de valorI suspect that the problem is the procedure init_jobs but I don't Know what could I do to resolve it.
Thanks in advance...sorry
I forget to remove it,
the code:
create or replace
PACKAGE body emp_pkg
IS
TYPE boolean_tabtype2
IS
TABLE OF BOOLEAN INDEX BY BINARY_INTEGER;
valid_jobs boolean_tabtype2;
PROCEDURE add_employee(
first_name employees.first_name%TYPE,
last_name employees.last_name%TYPE,
deptid employees.department_id%TYPE,
jobid employees.job_id%type)
IS
BEGIN
if valid_jobid(jobid) then
INSERT
INTO employees
employee_id,
first_name,
last_name,
email,
hire_date,
job_id,
department_id
VALUES
employees_seq.NEXTVAL,
first_name,
last_name,
SUBSTR(first_name,1,1)
||SUBSTR(last_name,1,7)
||'@buongio.com',
sysdate,
'SA_REP',
deptid
ELSE
RAISE_APPLICATION_ERROR (-20204, 'Invalid job ID. Try again.');
END IF;
END add_employee;
PROCEDURE init_jobs
is
begin
FOR rec IN
(SELECT job_id FROM jobs
LOOP
valid_jobs(rec.job_id):=true;
END LOOP;
END init_jobs;
function valid_jobid(
jobid employees.job_id%type)
return boolean
is
BEGIN
return valid_jobs.exists(jobid);
EXCEPTION
WHEN no_data_found THEN
dbms_output.put_line('no valid');
RETURN FALSE;
END valid_jobid ;
BEGIN
init_jobs;
END emp_pkg; -
ORA-06520: PL/SQL: Error loading external library
Hi
I am trying to use an external C program from sql using following steps.
copy the dll in dir ORACLE/806/BIN
create or replace library outs as
'e$/ORACLE/806/BIN/SmlCrcChecking.dll'
create or replace FUNCTION plsCheck_File_CRC (fname Varchar2)
return boolean
AS LANGUAGE C
library outs
name "Check_File_CRC";
and call the dll using
select plsCheck_File_CRC('c:\mttest.txt') from dual;
The dll is notc alled the message is
ERROR at line 1:
ORA-06520: PL/SQL: Error loading external library
ORA-06522: Unable to load DLL
Please help
PrashantI am trying to create a Pl/SQL test env using
create or replace procedure file_test
(fname in varchar2,
status out number)
is
begin
If Check_File_CRC (fname) then
status:=0;
else
status:=1;
end if;
end;
However the following errros are displayed
Errors for PROCEDURE FILE_TEST
6/1 PL/SQL: Statement ignored
6/4 PLS-00382: expression is of wrong type
mY TNSNAMES.ORA contains following
additions
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
(CONNECT_DATA = (SID = PLSExtProc)(PRESENTATION = RO))
extproc_connection_data.world =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = IPC)
(KEY = extproc))
(CONNECT_DATA =
(SID = extproc)
AND LISTNER.ORA
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\ora81)
(PROGRAM = extproc)
Message was edited by:
prashant13 -
ORA 60502 :PL/SQL Error
ORA 60502 :PL/SQL Error: numeric or value error : character to numeric
conversion error is displayed at the following line, all the variables are varchar2
rno :='XYZ-'+ substr(n1,1,15)
any solution ??
thanks
DSDMaybe change it to
rno := 'XYZ-' || substr(n1,1,15);?
C. -
Hi All
Currently I am working on .net based application and Oracle 8.0.6.00 (Multi language Support - (Japanese/English ))as backbend .
The above mention error is occurring from last few days on our production server when user is trying to save data .
I have already gone through all packages and procedure used in my application .
but i didn't find any conversion error .
Main Problem is that some time data is save properly even if error is occurred and some time it not saving data in to the DB. and the same error we are trying to reproduce on development server but it is not reproducing ...
I also checked all NLS Setting of my DB .but still in vague about this error
Can some help me......
Thanks & Regards
Shrirang
Message was edited by:
user528219As you said
Main Problem is that some time data is save properly even if error is occurred
and some time it not saving data in to the DB. and the same error we are trying to
reproduce on development server but it is not reproducing ...
I also checked all NLS Setting of my DB .but still in vague about this error
Can some help me......
Hi Khurram ,
Thanks for reply
the problem is not related any perticular code its big package which we call
to load , modify and save data . i have checked all code . my filed size is 4 time
more then specified size by user for a perticular field.
can you plz. suggest me any other way to solve this
SQL> CREATE OR REPLACE PACKAGE error_06502 AS
2 FUNCTION a RETURN VARCHAR2;
3 END error_06502;
4 .
SQL> /
Package created.
SQL> CREATE OR REPLACE PACKAGE BODY error_06502 AS
2 v1 NUMBER:='A';<----------------Damn it is an headache
3 FUNCTION a RETURN VARCHAR2 AS
4 BEGIN
5 RETURN 'No Error';
6 END a;
7 BEGIN
8 DBMS_OUTPUT.PUT_LINE ('Error is going to trapped for assigining variable v1..');
9 EXCEPTION WHEN OTHERS THEN
10 DBMS_OUTPUT.PUT_LINE ('Now error is handled..');
11 END error_06502;
12 .
SQL> /
Package body created.
First time
SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
BEGIN DBMS_OUTPUT.PUT_LINE(error_06502.a); END;
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "SCOTT.ERROR_06502", line 2
ORA-06512: at line 1
Now see here
SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
No Error
PL/SQL procedure successfully completed.See why error showed at first glance but not at second time why??
First Time
Whenever you execute the package first time it initiliased once for each
session,when i run this package first time package initialisation going to first time
and the assignment makes in variable v first time and raise the error though i
have exception block in my executable section which is responsible only to handle
errors that is raised in excutable section.
Second Time
Though package intitliasation is failed at first time (intiliasation dont occur properly
first time) ,Oracle marks the package is initialised and will run continously without
any error and return the string 'No Error' within the lenght of yours session when
you will drop yours session and again try to run the package it will raise the same
error first time
SQL> DISCONNECT
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> CONN scott/tiger
Connected.
SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
BEGIN DBMS_OUTPUT.PUT_LINE(error_06502.a); END;
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "SCOTT.ERROR_06502", line 2
ORA-06512: at line 1.
SQL> SET SERVEROUTPUT ON
SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
No Error
PL/SQL procedure successfully completed.Check your package variable assignment and error handling exception
properly,you had better to make assignment default value in the executable
section rather in the declaration section.In declartion section just declare the
variable but alls assignment should goes at executable section with definging the
exception which will handle the error nicely.
SQL> CREATE OR REPLACE PACKAGE BODY error_06502 AS
2 v1 NUMBER;
3 FUNCTION a RETURN VARCHAR2 AS
4 BEGIN
5 RETURN 'No Error';
6 END a;
7 BEGIN
8 DBMS_OUTPUT.PUT_LINE ('Error is going to trapped for assigining variable v1..');
9 v1:='A';
10 EXCEPTION WHEN OTHERS THEN
11 DBMS_OUTPUT.PUT_LINE ('Now error is handled..');
12 END error_06502;
13 .
SQL> /
Package body created.
SQL> EXEC DBMS_OUTPUT.PUT_LINE(error_06502.a);
Error is going to trapped for assigining variable v1..
Now error is handled..
No Error
PL/SQL procedure successfully completed.----------------------------------------------------------------------------------------------------------------
In my last post there would be another reason for this error i would code it here again..
May be the column you are storing the sequence in is defined as NUMBER2(6) to VARCHAR2(2). Some time ORACLE implicitly convert it if you have valid data in varchar2(2) column like 1,2,3 but if 1A,2A
e.g
SQL> DECLARE
2 a NUMBER(6);
3 BEGIN
4 a:='1';
5 END;
6 .
SQL> /
PL/SQL procedure successfully completed.
SQL> DECLARE
2 a NUMBER(6);
3 BEGIN
4 a:='1a';
5 END;
6 .
SQL> /
DECLARE
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 4If none of these reason which i had mentioned please let us know to share yours
workaround.
Khurram -
Error mapping function in external procedure call
I'm trying to create an external procedure in PL/SQL8.1 to run an operating system command from within a PL/SQL block.
The C function couldn't be simpler:
extern void host_command(char *command)
(void)system(command);
It's even ignoring the return value of SYSTEM!
I've generated what I THINK is a shared object file and copied it to $ORACLE_HOME/lib/host_command.so
I've then done CREATE LIBRARY HOST_COMMAND_LIB as '...'
Then I created a PL/SQL procedure:
CREATE PROCEDURE SHELL(IP_COMMAND IN VARCHAR2)
AS
LANGUAGE C
NAME "host_command"
LIBRARY HOST_COMMAND_LIB
PARAMETERS (IP_COMMAND);
And then EXEC SHELL ('touch /tmp/fred')
That's when ORA-6521 is raised.
I am running Oracle8.1.7.4.0 on AIX 4.3
Am I missing something?
Any suggestions will be thankfully received.
Andrew HunterThanks.
In fact, using the supplied makefile in $ORACLE_HOME/plsql/demo and MAKING SURE THAT THE .SO IS EXECUTABLE(!) works.
Maybe you are looking for
-
M500 120 GB mSATA hanging/crashing Windows 8.1 Ent after 1 year of use
Hi, I purchased a M500 120GB mSATA disk June '14 from Amazon, and installed it in my Sony Vaio T-Series laptop. I have been using it ever since and it has been fine and speedy. Since last week, I noticed my laptop started hanging applications and the
-
How To Display File Type?
Using iPhoto 6, I imported a number of image files from another computer. Many of the images were shot with cameras that save both raw and jpg files. I see that iPhoto, in the Library view, is displaying only the file number but not the suffix (.crw
-
Hi, My music video files appear in the Movie and All tabs in the Video catergory in itunes. How do I get them to come up in the Music Video tab selection? Kimmi
-
Opening port 51325 on firewall
Hello, In order to get a fast response when the print properties are asked in Office, port 51325 has to be opened on the firewall. After some research on the web I still can't find any reason why... Anyone knows what this port is used for? Are there
-
SOS...about my forum error code, can u help me?
I m writing a forum, a difficulty happen to me, the code is underside , the "test.Jsp " shows the content of forum, the other JAVA files connect Mysql DB, execute the SQL, ============the test.jsp========== <%@ page info= "ABOUT JSP���������������� J