How to handle infinity in PL/SQL ?
my function is returning a/b
a,b are number
retrun type is number...
how to deal with it ?
returning a Binary_float will do that, yes.
But the same is true for the original function. It only does an implicit datatype conversion to a binary_float.
strange result, btw
SQL> CREATE OR REPLACE FUNCTION TEST_FUNC
2 (
3 a IN NUMBER
4 , b IN NUMBER
5 )
6 RETURN BINARY_FLOAT
7 AS
8 BEGIN
9 RETURN a/b;
10 EXCEPTION
11 WHEN ZERO_DIVIDE THEN
12 RETURN 'infinity';
13 END;
14 /
Function created.
SQL>
SQL>
SQL> select to_char(test_func (1, 1.1), 'tm')
2 from dual
3 /
TO_CHAR(TEST_FUNC(1,1.1),'TM')
.909090936
SQL>
SQL> CREATE OR REPLACE FUNCTION TEST_FUNC
2 (
3 a IN NUMBER
4 , b IN NUMBER
5 )
6 RETURN BINARY_FLOAT
7 AS
8 BEGIN
9 RETURN to_binary_float (a)/to_binary_float (b);
10 END;
11 /
Function created.
SQL>
SQL>
SQL> select to_char(test_func (1, 1.1), 'tm')
2 from dual
3 /
TO_CHAR(TEST_FUNC(1,1.1),'TM')
.909090877both have less precision compared to using numbers...
Similar Messages
-
How to handle special characters in SQL statements
How do you handle special charactes in a SQL statement? Here is an example:
update table
set notefield = 'This is Waldo's note'
where keyfield = 7;
Because the database connectivity vi accepts a string datatype wire, the ' in Waldo's note is seen as the end of string and an error is generated.
Is there a way to tell labview that the ' is part of the string and not the string delimiter?
WaldoIf two single quotes don't work, try backslash single quote, like \'
The backslash is often used as an escape character, meaning to treat the next character literally.
- tbob
Inventor of the WORM Global -
ORA-022887 error during insert operation how to handle properly ...
Hello everyone I got an error during insert operation how to handle it properly ?
SQL statements given below.
INSERT INTO PERSONEL.TRANSLATIONS (TID,SCRIPT_NAME,TAG,TR,EN,LOCAL)
VALUES ((SELECT PERSONEL.SQX_TID.NEXTVAL AS TID FROM DUAL),'TEST_TEST','TEST','TR','EN','LOCAL');
thank youI could not find an error like ORA-022887. What is the exact error you are getting? Do a cut and past of the error here.
Ok the proper error is ORA-02287: sequence number not allowed here
As already said just remove the select and use the sequence directly in the insert.
Edited by: Karthick_Arp on Sep 11, 2009 1:04 AM -
How to handle EXTENDED Views SQL 2000 to Oracle Migration
Hi All,
I am in the process of migrating SQL server 2000 database to Orcle databse. I would like to know how to handle the views created in SQL server with Extended clause.
See below for example for SQL 2000 view.
create view "Order Details Extended" AS
SELECT "Order Details".OrderID, "Order Details".ProductID, Products.ProductName,
"Order Details".UnitPrice, "Order Details".Quantity, "Order Details".Discount,
(CONVERT(money,("Order Details".UnitPrice*Quantity*(1-Discount)/100))*100) AS ExtendedPrice
FROM Products INNER JOIN "Order Details" ON Products.ProductID = "Order Details".ProductID
Thanks in advance for your reply.
RameshRamesh
The Workbench has a problem with spaces in identifiers which will be fixed in a later release.
Apart from that large drawback the view should work ok. [The parser handles convert and aliases]
Turloch -
How to handle large result set of a SQL query
Hi,
I have a question about how to handle large result set of a SQL query.
My query returns more than a million records. However, the Query Template has a "row count" parameter. If I don't specify it, it by default returns only 100 lines of records in the query result. If I specify it, then it's limited to a specific number.
Is there any way to get around of this row count issue? I don't want any restriction on the number of records returned by a query.
Thanks a lot!No human can manage that much data...in a grid, a chart, or a direct-connected link to the brain.
What you want to implement (much like other customers with similar requirements) is a drill-in and filtering model that helps the user identify and zoom in on data of relevance, not forcing them to scroll through thousands or millions of records.
You can also use a time-based paging model so that you only deal with a time "slice" at one request (e.g. an hour, day, etc...) and provide a scrolling window. This is commonly how large datasets are also dealt with in applications.
I would suggest describing your application in more detail, and we can offer design recommendations and ideas.
- Rick -
Who know how to handle pl/sql table return from stored procedure calling from jsp
I have some stored procedure which return pl/sql table (index by table), It is look like an array. how jdbc handle this?
CallableStatement cs = con.prepareCall("EXECUTE bill.getcountry(?,?)");
cs.setInt(1, cid);
cs.registerOutParameter(2, java.sql.Types.VARCHAR);// ARRAY?
ResultSet rs = cs.executeQuery();
Array array = (Array) rs.getObject (1);
ResultSet array_rset = array.getResultSet ();Not that familiar with the OCI (Oracle Call Interface), but I think this call will be problematic - the OCI deals with SQL data types and not with PL/SQL structures.
The OCI has since Oracle 8i sported an object call interface (see OCI Runtime Environment for Objects for details).
This allows you to use the CREATE TYPE command to create advance user data types - and these are supported by the SQL engine, PL/SQL engine and external languages via the OCI.
So you need to have a look at the Perl-DBI documentation to see how it supports Oracle object types and consider using these. As for internal PL/SQL data structures. These are not supported by the SQL engine and I would expect limited or no support in the OCI for these. Anyway, using SQL data types makes a lot more sense ito flexibility and transparency across languages and environments. -
How to handle SQL code for Daylight Savings for MST Time zone
Hi,
1. My time zone is MST. My data showing differently as day light saving started from November. Please help me how to handle these issue.
2. After Mar 09 2014 Daylight saving going to end.( For this how to handle in the SQL codes)
Please answer for the above 2 doubts.
Thanks in advance.
Regards,
LuckyAbdulHi Abdul,
Daylight saving is basically like switching to another timezone. If your normal time zone is Mountain Standard Time (MST), you will switch to Mountain Daylight Time in the summer.
If daylight saving or timezones are a concern. It is best to store your dates in a DATETIMEOFFSET(0) column. This data type includes the offset between your selected timezone (MST or MDT) and UTC. The offset between MST and UTC is -7 hours and the offset
between MDT and UTC is -6 hours.
Be sure to datetimeoffset(0) and not just datetimeoffset. datetimeoffset(0) uses 8 bytes to store it's data (same as datetime), but datetimeoffset uses 10 bytes. This is especially important if you are going to index this column.
Also be sure to use a similar data type in your application or the timezone information will be lost. If it is an .Net application you should use The DateTimeOffset type. Most other programming languages have equivalent types.
Hope this helps. If you have anymore questions please let me know.
For more information see:
http://msdn.microsoft.com/en-us/library/bb630289.aspx
http://msdn.microsoft.com/en-us/library/ms187819.aspx
http://msdn.microsoft.com/en-us/library/system.datetimeoffset%28v=vs.110%29.aspx -
I have 3 server (Web server, database sql 2012 server and Active directory). I'm using sqlsvr version 3.0, PHP version 5.3 ,IIS version 7 and windows server 2008.
Right now my php connection to SQL 2012 using AD id, so How to handle if password on active directory change?Solved : Using Kaberos
-
SQL*Loader how to handle decimal place
Hi all
I need to load data into table with number field (12,2)
however, the source data is 1,025.02. Then the data cannot be loaded and in log, there is error message Invalid Number
Please kindly advise how to handle this in control file?
Thanks
Thomasload data
,YOUR_NUMBER_COLUMN .... ... ... " to_number(:YOUR_NUMBER_COLUMN,'999G999D99' , 'NLS_NUMERIC_CHARACTERS=''.,'' ')"
) -
How to handle null values in RTF templates
Hi - I have two groups in a report for different SQL and two formulas for each group, CF_ELE_CNT and CF_ELE_CNT1. In the template I use the below code to print or not print a section.
<?if:number(CF_ELE_CNT +CF_ELE_CNT1) >0?>
The problem is when there is no data in the second group its not creating the XML tag for CF_ELE_CNT1, though CF_ELE_CNT has 13, it still does not print that partucular section. If I remove CF_ELE_CNT1 from the condition it works fine. I was wondering how to handle this.
Any help would be appreciated!!
Thanks,
RavHey Rav,
You can add a check to identify it the element/tag is present or not
<?if:(CF_ELE_CNT1)?> will give true, if the element is present otherwise falsesince you are adding the two elements, you have to add a or condition.
<?if:(CF_ELE_CNT and number(CF_ELE_CNT) >0 ) or ( CF_ELE_CNT1 and CF_ELE_CNT1 >0)?> -
How to handle the quotes('') in the procedure?
Hi all,
I have been struggling with an issue in the procedure. Let us go to the functionality of the preocedure.
I am passing a parameter that has text like
' INDIA,BANGALORE,"INOX,BLR","THILAK NAGAR,JAYA NAGAR "4TH 'T' BLOCK,BANGALORE",560030'
Here, INDIA = country field
BANGALORE = city field
INOX,BLR = Theatre field
THILAK NAGAR,JAYA NAGAR "4TH 'T' BLOCK,BANGALORE = address field
560030 = pin field
I want to load these fields into the table thru procedure. Here the issue is if any field value come with quotes(") inside the quotes like above address field. Since , please guide me how to handle that quotes while identifying the field value for either or address field or some other one.
Table structure:
country varchar2(100 char)
city varchar2(100 char)
theatre varchar2(100 char)
address varchar2(2000 char)
pin NUMBER
Procedure Code:
create or replace
PROCEDURE prc_rollout_upload( p_text VARCHAR2 )
AS
v_quote_ind NUMBER := 0;
v_first_pos NUMBER := 0;
v_end_pos NUMBER := 0;
v_text_data varchar2(32767 CHAR) := p_text;
v_text_data1 varchar2(32767 CHAR);
v_text_arr_ind NUMBER := 0;
v_quote_pos NUMBER := 0;
v_comma_pos NUMBER := 0;
type text_rec IS RECORD(country VARCHAR2(20 CHAR),
CITY VARCHAR2(1000 CHAR),
exhibitor VARCHAR2(1000 CHAR),
address VARCHAR2(10000 CHAR),
PIN varchar2(6)
type v_text_tab is table of text_rec;
v_text_array v_text_tab := v_text_tab();
BEGIN
-- Fetch the values from the string to a PL/SQL table
v_text_data1 := v_text_data;
v_text_arr_ind := v_text_arr_ind + 1;
v_text_array.extend(v_text_arr_ind);
-- Country
IF (INSTR(v_text_data1, CHR(34)) > 0 )
THEN
v_quote_ind := INSTR(v_text_data1, CHR(34));
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).country := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).country);
v_text_data1 := SUBSTR(v_text_data1,v_end_pos+2);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
END IF;
IF ( v_quote_ind = 0 ) THEN
v_text_array(v_text_arr_ind).country := SUBSTR(v_text_data1,1,INSTR(v_text_data1,CHR(44))-1);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).country);
v_text_data1 := SUBSTR(v_text_data1,INSTR(v_text_data1,CHR(44))+1);
-- DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos := 0;
v_end_pos := 0;
v_quote_ind := 0;
END IF;
-- City
v_quote_pos := INSTR(v_text_data1,CHR(34));
v_comma_pos := INSTR(v_text_data1,CHR(44));
IF ( v_quote_pos < v_comma_pos )
THEN
v_quote_ind := INSTR(v_text_data1, CHR(34));
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).city := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).city);
v_text_data1 := SUBSTR(v_text_data1,v_end_pos+2);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
IF ( v_quote_pos > v_comma_pos ) THEN
v_text_array(v_text_arr_ind).city := SUBSTR(v_text_data1,1,INSTR(v_text_data1,CHR(44))-1);
-- DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).city);
v_text_data1 := SUBSTR(v_text_data1,INSTR(v_text_data1,CHR(44))+1);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos := 0;
v_end_pos := 0;
v_quote_ind := 0;
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
-- Exhibitor
v_quote_pos := INSTR(v_text_data1,CHR(34));
v_comma_pos := INSTR(v_text_data1,CHR(44));
IF ( v_quote_pos < v_comma_pos )
THEN
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).exhibitor := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).exhibitor);
v_text_data1 := SUBSTR(v_text_data1,v_end_pos+2);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
IF ( v_quote_pos > v_comma_pos ) THEN
v_text_array(v_text_arr_ind).exhibitor := SUBSTR(v_text_data1,1,INSTR(v_text_data1,CHR(44))-1);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).exhibitor);
v_text_data1 := SUBSTR(v_text_data1,INSTR(v_text_data1,CHR(44))+1);
-- DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos := 0;
v_end_pos := 0;
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
--Address
v_quote_pos := INSTR(v_text_data1,CHR(34));
v_comma_pos := INSTR(v_text_data1,CHR(44));
IF ( v_quote_pos < v_comma_pos )
THEN
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).address := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).address);
v_text_data1 := SUBSTR(v_text_data1,v_end_pos+2);
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
IF ( v_quote_pos > v_comma_pos ) THEN
v_text_array(v_text_arr_ind).address := SUBSTR(v_text_data1,1,INSTR(v_text_data1,CHR(44))-1);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).address);
v_text_data1 := SUBSTR(v_text_data1,INSTR(v_text_data1,CHR(44))+1);
-- DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos :=0;
v_end_pos := 0;
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
--PIN
v_quote_pos := INSTR(v_text_data1,CHR(34));
v_comma_pos := INSTR(v_text_data1,CHR(44));
IF ( v_quote_pos < v_comma_pos )
THEN
v_first_pos := INSTR(v_text_data1, CHR(34));
v_end_pos := INSTR(v_text_data1, CHR(34),1,2);
v_text_array(v_text_arr_ind).pin := SUBSTR(v_text_data1,v_first_pos+1,v_end_pos-2);
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).pin);
v_text_data1 := 0;
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
IF ( v_comma_pos IS NULL OR v_quote_pos > v_comma_pos ) THEN
v_text_array(v_text_arr_ind).pin := v_text_data1;
--DBMS_OUTPUT.PUT_LiNE(v_text_array(v_text_arr_ind).pin);
v_text_data1 := 0;
--DBMS_OUTPUT.PUT_LiNE(v_text_data1);
v_first_pos := 0;
v_end_pos := 0;
v_quote_pos := 0;
v_comma_pos := 0;
END IF;
EXCEPTION
WHEN others then
DBMS_OUTPUT.PUT_LiNE(SUBSTR(SQLERRM,1,200));
END prc_rollout_upload;
Oracle version :
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
Your help would be highly appreciated !!!
Regards,
Vissu.....To start with Try this:
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_var VARCHAR2(10000) := 'INDIA,BANGALORE,"INOX,BLR","THILAK NAGAR,JAYA NAGAR ';
3 v_delim VARCHAR2(1) := ',';
4 v_enclose VARCHAR2(1) := '"';
5 v_val VARCHAR2(1000) := NULL;
6 begin
7 v_var := v_var||'"4TH T BLOCK,BANGALORE",500365'||',';
8 FOR I IN 1..5 LOOP
9 v_val := CASE WHEN SUBSTR(v_Var,1,1) <> '"' THEN
10 SUBSTR(v_Var,1,INSTR(v_Var,',',1,1)-1)
11 ELSE
12 SUBSTR(v_Var,2,INSTR(v_Var,'",',1,1) - INSTR(v_Var,'"',1,1) - 1)
13 END;
14 v_Var := CASE WHEN SUBSTR(v_Var,1,1) <> '"' THEN
15 SUBSTR(v_Var,INSTR(v_Var,',',1,1) + 1)
16 ELSE
17 SUBSTR(v_Var,INSTR(v_Var,'",',1,1) + 2)
18 END;
19 dbms_output.put_line(v_Val);
20 END LOOP;
21* end;
SQL> /
INDIA
BANGALORE
INOX,BLR
THILAK NAGAR,JAYA NAGAR "4TH T BLOCK,BANGALORE
500365
PL/SQL procedure successfully completed.
SQL> -
How to handle the plsql error occuring in the exception block
We know how to handle exceptins which occur in BEGIN block.
But am unable to catch the exception in the exception block. Am writing an erroeneous code so that the control will go to exception block and there is also one plsql error, but am unable to handle that error, it's returning the error to the calling environment.
DECLARE
cnt NUMBER(5):=0;
BEGIN
select 'debalina' INTO cnt from dual;
DBMS_OUTPUT.PUT_LINE(to_char(cnt));
EXCEPTION
WHEN invalid_number THEN
DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
cnt:='deba';
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
END;
please suggest me how to catch this exception?Hi,
DECLARE
cnt NUMBER(5):=0;
BEGIN
select 'debalina' INTO cnt from dual;
DBMS_OUTPUT.PUT_LINE(to_char(cnt));
EXCEPTION
WHEN invalid_number THEN
DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
cnt:='deba';
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('error has occured inside begin block');
END;
First of all your namee exception which you have posted i.e invalid_number itself is wrong.
You need to use named exception VALUE_ERROR for catching the exception in the main block.
SQL> DECLARE
2 cnt NUMBER(5):=0;
3 BEGIN
4 select 'debalina' INTO cnt from dual;
5 DBMS_OUTPUT.PUT_LINE(to_char(cnt));
6 EXCEPTION
7 WHEN Invalid_number THEN
8 DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
9 end;
10 /
DECLARE
ERROR at line 1:
ORA-06502: PL/SQL: numeric or value error: character to number conversion error
ORA-06512: at line 4
SQL> DECLARE
2 cnt NUMBER(5):=0;
3 BEGIN
4 select 'debalina' INTO cnt from dual;
5 DBMS_OUTPUT.PUT_LINE(to_char(cnt));
6 EXCEPTION
7 WHEN VALUE_ERROR THEN
8 DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
9 end;
10 /
error has occured inside main block
PL/SQL procedure successfully completed.Your doubt regarding catching the exception in exception block, you can execute as below, by nesting a Begin block inside the exception block itself.
SQL> DECLARE
2 cnt NUMBER(35):=0;
3 BEGIN
4 select 'debalina' INTO cnt from dual;
5 DBMS_OUTPUT.PUT_LINE(to_char(cnt));
6 EXCEPTION
7 WHEN Value_error THEN
8 DBMS_OUTPUT.PUT_LINE('error has occured inside main block');
9 Begin
10 cnt:='deba';
11 Exception
12 WHEN OTHERS THEN
13 DBMS_OUTPUT.PUT_LINE('error has occured inside exception block');
14 End;
15 END;
16 /
error has occured inside main block
error has occured inside exception block
PL/SQL procedure successfully completed.Hope your doubt is clear.
Twinkle -
PDF Form to XML. How to handle invoice detail lines
I am using LC Designer 7.x on a PDF form that has a submit button that loads a ColdFusion MX7 page that will save the XML in a MS SQL 2005 XML field.
My source of confusion is how to handle the invoice detail lines on the PDF invoice form.
The XML that I want is
5 All Season Tires
400.02
A car with 5 wheels
20400.00
My question is how do I setup the form fields to do this.
What I did prior to XML was have fields whose name included the line number and store them as FDF.
eg
description01 amount01 description02 amount02
But that will not work, or I dont know how to translate that to the desired XML.
Any thoughts you might have would be appreciated.
Thanks
Archie CampbellArchie,
You want to create a subform called "invoiceLine" which you've set to repeat for each data item using the Binding tab of the Object palette. This subform must be contained within another (e.g. "invoiceLines") whose content is set to be "Flowed" on the Subform tab of the Object palette. So your object hierarchy looks like:
invoiceLines = subform with flowed content
invoiceLine = subform repeated for each data item
description
amount
Rob Gabbard
Cardinal Solutions Group
www.cardinalsolutions.com -
How to handle error while using dbms_sql.execute
Hi,
I am inserting some records by using the following piece of code.
stmt := 'insert into SSI_KPI_GOAL_VALUE_H (KPI_VAL_KPI_ID, KPI_VAL_RM_CDE,'|| v_day_value ||',KPI_VAL_ACT_DLY,'||v_month_val||',KPI_VAL_BIZ_UNIT_CDE) values (:kpi_array,:rm_array,:day1_array,:day1_array,:day1_array,:busnunit_array)';
l := dbms_sql.open_cursor;
dbms_sql.parse(l, stmt, dbms_sql.native);
dbms_sql.bind_array(l, ':kpi_array', col1_ins,1,ins_cnt-1);
dbms_sql.bind_array(l, ':rm_array', col2_ins,1,ins_cnt-1);
dbms_sql.bind_array(l, ':day1_array', col3_ins,1,ins_cnt-1);
dbms_sql.bind_array(l, ':busnunit_array', col4_ins,1,ins_cnt-1);
dummy := dbms_sql.execute(l);
dbms_sql.close_cursor(l);
I am getting an error since any one of the row contains value larger than the column.
How to handle exception handling for those rows which is having errors. I would like insert the records which is having
no errors. Like SAVE EXCEPTIONS for 'forall' is there any option is available to handle exceptional records.
Please help.
Thanks & Regards,
Hari.Hari,
What's oracle version? Are you looking for something similar to this? see following example
DECLARE
TYPE array
IS
TABLE OF my_objects%ROWTYPE
INDEX BY BINARY_INTEGER;
data array;
errors NUMBER;
dml_errors exception;
error_count NUMBER := 0;
PRAGMA EXCEPTION_INIT (dml_errors, -24381);
CURSOR mycur
IS
SELECT *
FROM t;
BEGIN
OPEN mycur;
LOOP
FETCH mycur BULK COLLECT INTO data LIMIT 100;
BEGIN
FORALL i IN 1 .. data.COUNT
SAVE EXCEPTIONS
INSERT INTO my_new_objects
VALUES data (i);
EXCEPTION
WHEN dml_errors
THEN
errors := sql%BULK_EXCEPTIONS.COUNT;
error_count := error_count + errors;
FOR i IN 1 .. errors
LOOP
DBMS_OUTPUT.put_line( 'Error occurred during iteration '
|| sql%BULK_EXCEPTIONS(i).ERROR_INDEX
|| ' Oracle error is '
|| sql%BULK_EXCEPTIONS(i).ERROR_CODE);
END LOOP;
END;
EXIT WHEN c%NOTFOUND;
END LOOP;
CLOSE mycur;
DBMS_OUTPUT.put_line (error_count || ' total errors');
END;Regards
OrionNet -
How to handle an invisible character in a string?
Hi,
I have an interesting situation-
select bac_person_id, length(bac_person_id) from bkmap_personid_stg where BAC_PERSON_ID like '%27136317%'
The result is -
BAC_PERSON_ID|LENGTH(BAC_PERSON_ID)
27136317| 9
I don't know what is the invisible character here?
It is certainly not a blank character as trim is not working -
select * from bkmap_personid_stg where trim(BAC_PERSON_ID) = '27136317'
no records!!
But substr does give me the resullt -
select * from bkmap_personid_stg where substr(BAC_PERSON_ID,1,8) = '27136317'
How can I know which is the last character? and How to handle it?girija_pathak wrote:
How can I know which is the last character? and How to handle it?You use the DUMP() function in SQL in order to see the actual content of the column.
E.g.
select DUMP(bac_person_id) from bkmap_personid_stg where bac_person_id like '%27136317%'
The decimal character values will be displayed - enabling you to see where and what control characters characters exist in the string value for that column.
Maybe you are looking for
-
Error While creating loan repayment plan
Hi While I am reating loan repayment plan after making the necessary inputs in the loan(0045) IT it is showing the following errror. We are having only the interest free loans. <b>Effect.int.rate cannot be calculated because no flow records exist</b>
-
It seems that the current version of Firefox does not understand how to process style sheets. Instead of the stylesheet background color or image, I am now seeing my PC's desktop background image. This does not happen with IE or Chrome. When checking
-
How to make a graph inside a while loop maintain previous values
In the beginning I was trying to use an the XY Graph Express VI to create a plot of points. However, the graph is making a linear retrace between the first point of the new line, and the last point of the previous line. It then creates the new line
-
Hello, Ive checked the forums ect, and it says this error is returned when there is an invalid user name or password (in the routers settings), but i confirmed with my ISP, that the user name and password i entered into the router's setting is correc
-
Where did everything go?
Can someone please help me out here? I used to plug in my phone with the USB cord, back up and restore my information on my Iphone 4s...update the software, do another back up and restore and then I was done. Now? Well I thought I had iTunes up then