Skip to main content

SQLCODE & SQLERRM Function



The SQLCODE function returns the error number associated with the most recently raised error exception. This function should only be used within the Exception Handling section of your code.

The SQLERRM function returns the error message associated with the most recently raised error exception. This function should only be used within the Exception Handling section of your code.
You could use the SQLCODE & SQLERRM  function to raise an error as follows:
EXCEPTION
   WHEN OTHERS THEN
      raise_application_error(-20001,'Error - '||SQLCODE||' -ERROR- '||SQLERRM);
END;
Or you could log the error to a table using the SQLCODE & SQLERRM function as follows:
EXCEPTION
   WHEN OTHERS THEN
      ERR_CODE := SQLCODE;
      ERR_MSG := SUBSTR(SQLERRM, 1, 200);

      INSERT INTO XXERROR_TABLE (ERROR_CODE, ERROR_MSG)
      VALUES (ERR_CODE, ERR_MSG);
END;

Comments

Popular posts from this blog

LDT Commands in Oracle Apps

 Oracle Applications (Oracle E-Business Suite) use Loader Data files (LDT files) for migrating application configurations and data between instances. What are LDT Files? LDT files are plain text files used by the FNDLOAD utility in Oracle E-Business Suite to upload or download data from the database. They are commonly used for migrating setups, such as concurrent programs, value sets, and lookups, across different environments. LDT Commands: 1.        Download Data to LDT File FNDLOAD apps/apps_pwd 0 Y DOWNLOAD $FND_TOP/patch/115/import/afcpprog.lct output_file.ldt FND_PROGRAM APPLICATION_SHORT_NAME="Application_Short_Name" CONCURRENT_PROGRAM_NAME="Program_Name" 2.        Upload Data from LDT File FNDLOAD apps/apps_pwd 0 Y UPLOAD $FND_TOP/patch/115/import/afcpprog.lct input_file.ldt Key Parameters apps/apps_pwd : The username and password for the Oracle Apps database. 0 Y...

API to Create & Update Price Adjustment and Order Lines

Important Tables: select header_id from oe_order_headers_all; select line_id from oe_order_lines_all; select list_header_id from qp_list_headers_all; select list_line_id from qp_list_lines; CREATE OR REPLACE PROCEDURE apps.xxapply_discount (p_header_id number) IS    v_api_version_number           number := 1;    v_return_status                varchar2 (2000);    v_msg_count                    number;    v_msg_data                     varchar2 (2000);    -- in variables --    v_header_rec                   oe_order_pub.header_rec_type;    v_line_tbl                     oe_order_pub.line_tbl_type;    v_action_request_tbl   ...

Oracle BI Publisher - Leading zeros truncated for excel reports - format numbers as text

When you want to display some data which has leading zeros in EXCEL output you will not get the desired output. But in PDF it will come as what you are expecting. This is not with the issue of your data. This is due to the unique nature of EXCEL cell format. When you are trying to put a text data in a cell without making any change to cell format it will treat as number and it will truncate all leading zeros and all trailing zeros after ' . ' . So what you have to do is to convert that data into a format which EXCEL can treat as text.   1. In the rtf template, add two spaces before the column. 2. Use the following xml tag <fo:bidi-override direction=”ltr” unicode-bidi=”bidi-override”> <?format-number:INVOICE_NUMBER;’09999999′?> </fo:bidi-override>”   3. Instead of the using the tag < ? INVOICE_NUMBER? > use  =”<?INVOICE_NUMBER?>”.  Excel treat value as character and doesn’t trim the leading zeors of value....