How To Write Exception Handler For PL / SQL

Jan 22, 2007

How to write an exception handler for the error "PL/SQL: ORA-01031: insufficient privilege"

View 2 Replies


ADVERTISEMENT

Application Express :: Exception Handling Pl Packages And APEX Exception Handler

Oct 7, 2013

APEX 4.2Oracle 11g Database We are using the standard exception handler that was introduced in APEX 4.1, and we have code in packages & procedures in the database (following proper processes of keeping code in the database where possible).  When an exception is found in the procedures/ packages/functions, should the APEX application level exception handler catch any errors that occur or should they be handled in the package/procedure/function they occurred in? Why I ask if, we right now have exception handling code in the pl/code bodies BUT they write their errors to the same table that Apex's Exception handler does, but the errors are NOT presented to the user using the APEX exception handling mechanism.

View 2 Replies View Related

SQL & PL/SQL :: Exception Handler For ORA-1722 Invalid Number

Oct 8, 2012

I have to ask a pretty basic question (my pl/sql skills need serious work). I need to validate that a string can be converted to a number, and if it can't be, substitute something else. This works:orcl> create or replace function jw_to_number(str varchar2) return number is

2 n number;
3 begin
4 n := to_number(str);
5 return n;
6 exception when others then return 0;
7 end;
8 /

Function created.

orcl> select jw_to_number('a') from dual;
JW_TO_NUMBER('A')
-----------------
0
orcl>

but of course I don't want to use WHEN OTHERS. So I tried this:orcl> create or replace function jw_to_number(str varchar2) return number is

2 n number;
3 begin
4 n := to_number(str);
5 return n;
6 exception when INVALID_NUMBER then return 0;
7 end;
8 /

Function created.

orcl> select jw_to_number('a') from dual;
select jw_to_number('a') from dual
*
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at "SCOTT.JW_TO_NUMBER", line 4
orcl>I

thought this would replace the standard error handler with my own, but it doesn't. I tried redeclaring the pre-defined exception, same result.

View 4 Replies View Related

Forms :: Implement Exception Handling In Exception Block Of A Trigger

Oct 10, 2011

I have to implement exception handling in the exception block of a trigger, Quote:exception

when ora_java.java_error then
message( 'Unable to call out to java, ' || ora_java.last_error );
ORA_JAVA.CLEAR_EXCEPTION;

when ORA_JAVA.EXCEPTION_THROWN then
ex := ORA_JAVA.LAST_EXCEPTION;
message( Exception_.toString(ex));
-- lv_exception := Exception_.getMessage(ex);

I get an error for the line: 'message( Exception_.toString(ex));'I have imported the java classes FException et IObject with their methods.

I have to create a Web Service Client, so I wonder if the paragraph Quote:when ORA_JAVA.EXCEPTION_THROWN then ex := ORA_ JAVA. LAST_ EXCEPTION; is mandatory.

View 2 Replies View Related

ORA-12520 / TNS / Listener Could Not Find Available Handler

May 5, 2013

I am using Oracle 11gR2 from one application (Oracle Client 32 bit), I am facing ORA-12520. I do not have any errors at the server level.

how can I investigate it ? can it be related to the number of processes ?

View 8 Replies View Related

Server Administration :: Listener Log - No Appropriate Service Handler Found?

May 22, 2012

On last Saturday we encountered error 'TNS-12519: TNS:no appropriate service handler found" in our listener log for some moment of time let say around 5mins and later it got all right itself.

View 3 Replies View Related

Networking And Gateways :: Listener Could Not Find Available Handler For Requested Type Of Server

Jun 20, 2010

I have ora-12520. I run Oracle 11g on Red Hat 4 64 bit. Actually I have RAC but one node is down and I work only with up one (connection string point directly to listener of running node). I run test with not too big loading. select count(*) from v$sessions gets ~ 200 in maximum loading, but after half minutes I get this error in my logs. Each time, lsnrctl services show that all is right. It shows one service with one handler. I see nothing in alert.log. This is very strange, I know, and I'm sure that this is an actual alert.log because, I see there other events in actual time. Most important: I have SESSION parameter set to 600 and PROCESSES set to 400 so this must be enougha...

View 3 Replies View Related

SQL & PL/SQL :: How To Get Statement That Causes Exception

Jul 17, 2011

I am using Exception when others then body end;

inside the body i can get SQLCODE and SQLERRM but I also need to get the SQL statement that caused the error and I dont know how.

View 39 Replies View Related

SQL & PL/SQL :: How To Handle The Exception

May 19, 2011

The following code is working fine,But the thing is if column already exists in the table,then also the other statements should be executed instead of coming out of procedure.SO how can I handle that exception??

SQL> CREATE OR REPLACE PROCEDURE sp_execparameters(tname IN VARCHAR2,
colname IN VARCHAR2,datatype IN VARCHAR2)
2 AS
3 v_sqlstr1 VARCHAR2(1000);
4 BEGIN
5 v_sqlstr1 := 'alter table '||tname||' add '||colname ||' '|| datatype ;
[code].........

View 3 Replies View Related

SQL & PL/SQL :: Exception Is Not Raising?

Sep 16, 2010

1 declare
2 cursor c1 is select * from emp where deptno=&no;
3 begin
4 for i in c1 loop
5 dbms_output.put_line(i.empno||' ' || i.sal);

[code]...

PL/SQL procedure successfully completed.

SQL> /
Enter value for no: 120
old 2: cursor c1 is select * from emp where deptno=&no;
new 2: cursor c1 is select * from emp where deptno=120;

PL/SQL procedure successfully completed.

Even though deptno 120 is not there in emp table, the exception is not raising?

View 4 Replies View Related

SQL & PL/SQL :: Exception Handling?

Jul 16, 2012

Is it possible to take execution control back from exception handling section to Execution statement?.. If Yes then How?..

View 25 Replies View Related

ORA-07445 - Exception Encountered?

May 9, 2011

Am getting the error ORA-03113: end-of-file on communication channel when am trying to run a query and when i checked the trace file the infromation i got is given below.....

CODEksedmp: internal or fatal error
ORA-07445: exception encountered: core dump [ACCESS_VIOLATION] [0x363376E] [] [] [] []
Current SQL statement for this session:
select
count(av_sal)

[code]...

View 1 Replies View Related

SQL & PL/SQL :: Getting Column Which Caused The Exception?

Jan 14, 2008

I am using Oracle 10g Rel 2 and currenly working on a project which creates a repository and bulk inserts data into it using FORALL statment. I am using SAVE Exceptions to save the errors in a table and then report to the user about these errors.

My question is ,can i somehow know the column which caused the exception ? Currently ,we can save only SQLCODE and SQLERRM . Is there any possibility that I get to know the column also which raised the exception ? For example ,during a insert ,if column raises exception

ORA-01438: value larger than specified precision allows for this column

Is it possible for me know using some programming technique that which column raised this exception ?

View 12 Replies View Related

Forms :: How To Add Exception In Given Query

Nov 3, 2011

when no data found this query generate error ora-01403 but if i count these transaction and then apply this trigger it works very well i am not interested to count because it takes a time i want that when no data found exception clause took control but i am not understand how to add exception clause in this trigger

select sum(nvl(gl_quantity,0)),sum(nvl(gl_amount,0)) into cr_qty,cr_amt from account.glhis where gl_drcr='CR' and gl_account=:prod_consume_auto.store_code and gl_date<=:prod_master_auto.voc_date and gl_voc_no<>:prod_master_auto.voc_no group by gl_account;

View 3 Replies View Related

NL Exception Trying To Connect To 10g RAC With JDBC

Jan 11, 2005

I'm trying to connect to multiple Oracle 10g databases (failover) over the JDBC thin client, and when I run the following, I get: java.sql. SQLException: Io exception: NL Exception was generated

connection = DriverManager.getConnection("jdbc:oracle:thin:@DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = dbdev) (PORT = 1521))) (CONNECT_DATA = (INSTANCE_NAME = orcldev)))", "scott", "tiger");

I eventually want to put multiple ADDRESSes in that string, but right now I'm trying to get it to work with just one! I've tried multiple variations of this, like changing INSTANCE_NAME to SID or SERVICE_NAME, and using the internal IP address for the HOST dbdev (see below). Here's the tnsnames.ora file used by SQL*Plus on the same client machine:

ORCLDEV.world =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.132)(PORT = 1521))
(CONNECT_DATA =
(SID = orcldev)
)
)

View 7 Replies View Related

SQL & PL/SQL :: 1843 Non-ORACLE Exception?

Sep 22, 2010

i cant trace out why this exception is for Below given is my scripts create or replace package body pkg_rwc_migration as
procedure pro_rwc_mig as

cursor cur_mig_job is select substr(job_id,1,4) "JOB_ID",5 "JOB_STAGE_ID",gii_app_id "GII_APP_ID",
gai_app_id "GAI_APP_ID",status_id "STATUS_ID",job_type "JOB_TYPE",
'jobdesc' "JOB_DESC",current_assignee "CURRENT_ASSIGNEE",CREATED_DATE "CREATED_DATE",
CREATED_BY "CREATED_BY",MODIFIED_DATE "MODIFIED_DATE",MODIFIED_BY "MODIFIED_BY",
IS_COMPLETE "IS_COMPLETE",OVERWRITTEN_BY "OVERWRITTEN_BY",OVERWRITTEN_DATE
[code]...

when others then

v_error_code := SUBSTR(v_error_code||':'||SQLCODE,1,30);
For i in 1 ..sql%bulk_exceptions.count LOOP
v_error_desc := SUBSTR( SQLERRM(SQL%BULK_EXCEPTIONS(i).ERROR_CODE),1,400);
dbms_output.put_line('The value of Error is '|| v_error_code ||' '||v_error_desc);
End loop;

[code]...

By executing the above i am getting Error
SQL> @pkg_rwc_migration_bdy.sql
130 /

Package body created.

SQL> Begin
2 pkg_rwc_migration.pro_rwc_mig;
3 End;
4 /
The value of Error is :-1843 -1843: non-ORACLE exception

View 2 Replies View Related

SQL & PL/SQL :: Have Exception In Declare Block

Feb 20, 2012

Can we have any exception in DECLARE block (shown are just for example)?

Declare
exception occured
begin
code
end;

declare
variables;
begin
declare
variables;
begin
code;
end;
end;

View 6 Replies View Related

SQL & PL/SQL :: How To Handle Exception For ORA-06550

Nov 17, 2011

I trying to Assign XML content to the clob variable inside the pl/sql block, But i am getting the Below Error:

declare
t clob;
begin
t := 'xml content exceeds 32000 characters'

update test
clob_cloumn = t;
where id =2;

exception
when others then
null;
End;

ORA-06550: line 5, column 4:
PLS-00172: string literal too long

I need to handle this exception, i know it length exceeds 32000 characters, but even though i need to handle the exception and to perform other operation after handling the exception.

View 5 Replies View Related

SQL & PL/SQL :: How To Get Exception Name And Error Text

Aug 21, 2012

I'm inserting to a table through a procedure, I want to log the rejected records to a log table with the execption / reason.How can I get the exception name and error text in PL/SQL ?

View 20 Replies View Related

SQL & PL/SQL :: Exception At Update Trigger

Aug 14, 2012

I am writing a trigger TR_EMP on a table EMP which has columns EMP_ID, EMP_NAME, ALT_EMP_ID.

Now I am updating ALT_EMP_ID for an EMP_ID(PK) which is unique.

If ALT_EMP_ID is null
then
:new.ALT_EMP_ID = l_alt_emp_id;
end if;

As this ALT_EMP_ID is unique, same ID shouldn't be inserted again here. When data being inserted with 2 different sessions for 2 different EMP_ID there is a possible chance of inserting same ALT_EMP_ID for both which results in Unique error. I need to handle this exception. DUP_VAL_ON_INDEX or OTHERS Execption not able to handle this.

View 4 Replies View Related

PL/SQL :: Exception Handling In Procedures

Oct 8, 2012

I am using for writing text files data to database. The problem here is let us assume there are 6 records in text file and if there is a problem at 2nd record, the later records are not getting inserted.

CREATE OR REPLACE PROCEDURE PROC1
IS
temp varchar2(500);
tmp_name varchar2(5);
tmp_no varchar2(4);
.
BEGIN
WHILE NOT end_of_file
LOOP

IF i = 18 THEN
tmp_no := temp;
END IF;

IF i = 21 THEN
tmp_name := temp;
END IF;

END LOOP;
END;
/If i=18 and temp = '12345' here, then tmp_no := temp; won't work (tmp_no varchar2(4);)
Similarly, If i=21 and temp = 'ABCDEFG' here, then tmp_name := temp; won't work (tmp_name varchar2(5));

how to handle this through EXCEPTIONS so that even if there is a problem with 1 record, while loop remain working for further records..

View 4 Replies View Related

Can't Write SQL Scripts On Oracle G10

Apr 8, 2009

I just install the oracle g10 on my laptop, which runs windows XP and it seems to work fine BUT it will not allow me to write Scripts I go to the Script Editor, i can write on the "Script Name" but below i cant ever put the cursor to write the script!

View 3 Replies View Related

How To Write Audit Script

Oct 14, 2008

To write a audit script, that will analyze SQL usage and the performance of both individual statements and the overall memory utilization.

View 1 Replies View Related

SQL & PL/SQL :: How To Write Package For Deletion

Apr 21, 2012

how to write the package for deletion?

View 1 Replies View Related

SQL & PL/SQL :: How To Write Correlated Sub Query

Sep 13, 2010

I have employee, location, city tables, I have written following code to use joins

select ename from employee e, location l, city c
where e.c_locationid= l.locationid and l.cityid= c.cityid and c.cityname='XYZ';

The same can be written by using non- correlated sub query as follow..

select ename
from employee
where c_locationid in (select locationid from location where
cityid in (select cityid from city where cityname='XYZ'))

I need to implement the same concept using correlated sub query...

View 15 Replies View Related

How To Write Trigger In Oracle 10g

Apr 12, 2011

I am using SQL*Plus to run this Oracle10g. Here is my problem I have to solve: After a new record is added to the task table, write a trigger that reports the new project balance to the user while updating the customer balance to reflect this additional task cost. Insert a new record to show the trigger works. I somewhat understand triggers,I think I have to combine tables to solve this. Here are my tables/attributes I can use to solve it:

CREATE TABLE customer
(
custnoNUMBER(3)CONSTRAINT ccustpk NOT NULL PRIMARY KEY,
custname CHAR(20) CONSTRAINT ccustnamenn NOT NULL,
phone CHAR(12),
curr_balance NUMBER(9,2) CONSTRAINT ccustbalancenn NOT NULL

[code]...

View 8 Replies View Related

SQL & PL/SQL :: How To Write LAST_INSERT_ID () In Oracle

Sep 25, 2013

I have a procedure in mysql that need to be converted to oracle.I tried to convert it ,everything looks good except the function LAST_INSERT_ID().

mqsql procedure

DELIMITER ;;
CREATE DEFINER=`root`@`localhost` PROCEDURE `add_ac_message`(
IN in_process_run_id INT,
IN in_processID INT,
IN in_messagename VARCHAR(25),
IN in_message VARCHAR(200))
BEGIN
[code]......

oracle procedure

create or replace
PACKAGE body Mysql_To_Oracle
IS
Procedure Add_Ac_Message(In_Process_Run_Id In Number,
In_Processid In Number,
In_Messagename In Varchar2,
In_Message In Varchar2)
[code]....

Error:
ORA-00904: "LAST_INSERT_ID": invalid identifier
00904. 00000 - "%s: invalid identifier"

View 6 Replies View Related

SQL & PL/SQL :: How To Write Column To Row In A Query

Nov 17, 2005

How to write column to row...in a SQL query?

For example..

SQL> select empno,deptno from emp where empno = 7369;
EMPNO DEPTNO
---------- ----------
7369 20
7369 10
7369 40

The above output to be written in a single row like given below.

7369 20 10 40

1) Actually it may change dynamically...It may be 2 records for some values and there may be 10 records for some value and different for some other

2) It should be in SQL query only..Not in procedures or functions.

View 9 Replies View Related

PL/SQL :: Write Clob Or Xml To A File?

Jul 9, 2013

I have read the following article:[URL] 11070I want to know wherer if there exists a possibility of write a clob or an xml into a file on disk, if we do not have the CREATE ANY DIRECTORY privilege. Many functions, like UTL_FILE.FOPEN, or dbms_xslprocessor.clob2file, or dbms_xmldom.writetofile, need an Oracle directory to be created (with CREATE OR REPLACE DIRECTORY...). But if we don't have this privilege, is there a possibility to export a clob into a file as xml (the clob contains 100% xml, but this is the column data type, CLOB) if we don't have that privilege?The clob data contains 48200 characters.

View 8 Replies View Related

Oracle 11g - Exception While Importing Statistics?

Jul 14, 2010

I am using Oracle 11g R2 version.I want to import the DB statistics. But i am getting an exception when i execute the command DBMS_STATS.IMPORT_SCHEMA_STATS ('user1','STATS_INFO', '','', TRUE, FALSE).

The error is ORA-20000: no statistics are imported ORA-06512: at "SYS.DBMS_STATS", line 10603 ORA-06512: at line 1.

The privileges 'ANALYZE ANY' and 'ANALYZE ANY DICTIONARY' is already given to the user.Also i executed this command as sys. But still error occurs.

Same command is successfully executed in Oracle 10g. Is there any difference in importing the statistics in Oracle 10g and 11g ?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved