Exp function and numberic overflow ORA-01426
I've got a problem that has been driving me slightly mad over the past few days. I have been trying to code some actuarial functions that I don't really understand for a data warehouse load on Oracle 9.2.0.6
I am trying to use exp() and power() functions in an insert statement. There is some slightly dodgy data in the source table that is causing a numeric overflow to occur for some rows so I have written a function which calculates the values and returns the result. If an exception occurs, this will be caught and the result set to 0.
The problem I am finding is that within the function, the power() function will successully raise a value_error exception when a problem occurs. However, the exp() function will not. When calling exp() with a large number as the parameter, it will simply return 1e126, which will subsequently cause a numeric overflow when calculating the value for another column.
However, the number overflow will be raised if I use select exp(...) into ... from dual
Is this just a weird inconsistency between the SQL and PL/SQL engine. I thought these problems had been resolved with Oracle 9 but I guess not.
I think I can probably work-around the problem for here, just looking for confirmation that my thoughts are correct.
I hadn't realised that 9.2.0.8 was the most recent patch set for Oracle 9i or that we were a couple of patch sets behind. Maybe I'll have to chase that up but I'm sure we've got a reason for not patching. Whether that would be a good reason or not is probably debateable.
An upgrade to 10g or 11i is in the pipeline but it is currently moving at glacial speed.
Similar Messages
-
ORA-01426: numeric overflow when creating job
Hello,
When executing the following script to create a job I get the error "ORA-01426: numeric overflow" . When I execute the same script on another database with same version and same configuration I do not get the error and the job is created.
Can anyone help me out solving this issue?
Script:
DECLARE
X NUMBER;
BEGIN
SYS.DBMS_JOB.SUBMIT
( job => X
,what => 'insert into dba.dba_logs values (''SGC'',''TRL03'',sysdate,null);
commit;
,next_date => to_date('07-11-2010 02:00:00','dd/mm/yyyy hh24:mi:ss')
,interval => 'NEXT_DAY(TRUNC(SYSDATE)+2/24,''SUNDAY'')'
,no_parse => FALSE
SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(x));
COMMIT;
END;
Database version: 11.2.0.1
OS: HPUXWe are planning to migrate to dbms_scheduler, but that's in the future. for now we have this error first to solve.
We also tried the following with dbms_scheduler and it gives the same error. The strange is that in another database with same version and same OS it works fine.
BEGIN
SYS.DBMS_SCHEDULER.CREATE_JOB
job_name => 'JOB_CLIENTES_IN'
,start_date => SYSTIMESTAMP
,repeat_interval => 'FREQ=MINUTELY;INTERVAL=10'
,end_date => NULL
,job_type => 'STORED_PROCEDURE'
,enabled => TRUE
,job_action => 'JOB_CLIENTES_FTP_IN'
,comments => 'Job que carrega os ficheiros de pre-aviso de cliente'
END;
ORA-01870: the intervals or datetimes are not mutually comparable
ORA-01426: numeric overflow
ORA-01426: numeric overflow
ORA-06512: at "SYS.DBMS_ISCHED", line 124
ORA-06512: at "SYS.DBMS_SCHEDULER", line 271
ORA-06512: at line 2
Edited by: cibernauta on Nov 4, 2010 12:48 PM -
[Oracle][ODBC][Ora]ORA-01426: numeric overflow
I have a function get data from data base and do some calculating. I call this function from ASP web page. Some times I got the following error. But if I click refresh later. It's ok again. Any ideas?
[Oracle][ODBC][Ora]ORA-01426: numeric overflowCause: Evaluation of an value expression causes an overflow/underflow.
Action: Reduce the operands. -
ORA-01426: Numeric Overflow During Cube Build (Doc ID 1494869.1)
Our cube builds starting failing and we received this error after the cube log table sequence reached 32787.
After recreating the sequence the builds run successfully. This seems to be an unacceptable bug for an enterprise level product.
I have been unable to find a patch on the Oracle support site for it. Is a patch avaliable?
COMP_NAME
VERSION
OLAP Analytic Workspace
11.2.0.4.0
Oracle OLAP API
11.2.0.4.0
OLAP Catalog
11.2.0.4.0I found what appears to be a related bug Bug 14627371 - ORA-01426: NUMERIC OVERFLOW DURING CUBE BUILD
. This bug is marked as fixed in 12.1 of the database.
I think that you may want to pursue this issue with support to see whether this can be back-ported ton 11.2.0.4.0.
--Ken Chin -
Exp/imp procedures, functions and packages question
Hi
I've a 9i R2 version Oracle database. I would like to export procedures, functions and packages from a schema. How do I do that?
Is there any script or command lines can provide?
ThanksHello user12259190.
You can do an export of the user itself, excluding table data as inH:\>exp
Export: Release 10.2.0.1.0 - Production on Tue Dec 22 11:22:52 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Username: db_user@db_sid
Password:
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Data Mining and Real Application Testing options
Enter array fetch buffer size: 4096 >
Export file: EXPDAT.DMP >
(2)U(sers), or (3)T(ables): (2)U > 2
Export grants (yes/no): yes > no
Export table data (yes/no): yes > no
Compress extents (yes/no): yes > no
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
server uses UTF8 character set (possible charset conversion)
Note: table data (rows) will not be exported
Note: grants on tables/views/sequences/roles will not be exported
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user DB_USER
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user DB_USER
About to export DB_USER's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export DB_USER's tables via Conventional Path ...
. . exporting table TABLE_NAMEs
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.Unfortunately, you can't export just the objects you want to unless they are tables.
Using import (imp) you can list the content of your packages, procedures, functions, views, etc. and perhaps that will give you what you need.
Another choice would be to useSELECT * FROM user_source ORDER BY 2, 1, 3;to list the code.
Hope this helps,
Luke -
ORA-01426: numeric overflow, while migrating "float" values
When I try to insert a value of *2.58612749363472E302* (originally a "float" in SQL DB) into an Oracle column of type float(126), I get this error "ORA-01426: numeric overflow"
I tried changing the column type to BINARY_FLOAT, BINARY_DOUBLE, but I still get same error.
I'm using Oracle SQL Developer (2.1.1.64.45) to migrate a SQL Server 2005 Database to Oracle 11g.
Do you have any thoughts on this? Or workarounds?
Thanks in advance.
ArulArul,
I have checked the Migration Workbench documentation where it says for float data -
Oracle® SQL Developer
Supplementary Information for Microsoft SQL Server and
Sybase Adaptive Server Migrations
Release 2.1
Table 2–2 Data Types in Oracle and Microsoft SQL Server or Sybase Adaptive Server
NOTE: If you try to migrate
floating point data greater
than or equal to 1.0E+126
then SQL Developer will fail
to insert this data in the
Oracle database and1 will
return an error.This also
applies to negative values
less than or equal to
-1.0E+126.
So, if I understand it correctly your value of 2.58612749363472E302 is outside this range.
Regards,
Mike -
Which functions and features in Numbers are NOT exported correctly to Excel?
I wish to know EXACTLY which functions I use in a Numbers sheet WILL FAIL to export correctly to an Excel or Neoffice spreadsheet.
For instance, I created a Numbers spreadsheet using prolific use of the IFERROR function. However, when I EXPORT to XLS, all the cells that used the IFERROR function were replaced by the literal value of the cell. My IFERROR formulae were not EXPORTED as I had expected.
I note that some formulae were converted correctly in my EXPORTED spreadsheet: eg MAX, MIN, AVERAGE.
I understand that IFERROR was a function introduced recently to Excel, ie in the 2007 version. Consequently, I suspect that Numbers exports to a pre-2007 version of Excel. If so, which version?
I have found this list that shows which functions are compatable amongst various versions of Excel:
Excel Functions: Compatibility Reference (2010, 2007 & 2003). (n.d.). Retrieved from https://docs.google.com/spreadsheet/ccc?key=0AsHau4_IeCfwdG45c0VhcjBBUGNreVo2ZzN NRU1BT0E#gid=0
This list shows that, for instance, IFERROR exisits inb both Excel 2007 and Numbers-09. So why is IFERROR not exported?
Curmi, J. (n.d.). Summary of function in excel and numbers-09. Retrieved from http://curmi.com/blog/wp-content/uploads/2009/01/functions-in-excel-and-numbers- 09.pdf
Some examples of my use of ISERROR in Numbers are as follows:
=IFERROR(RANK(C47,$C47:$J47,1),"")
=IFERROR(MEDIAN(C51:C58),"")
=IFERROR($C32-C88+1,"")
I use the above function to carry out the calculation ONLY IF a cell is non-blank and contains a number.
More questions
What are the rules that Numbers uses to convert to Excel?
Is Numbers converting to the 2003 version of Excel? ... or an earlier version? ... which version?
Why desn't Numbers advise me there were conversion errors or simplifications made?
eg: "Cell A33 Function IFERROR was exported to the cell value for Excel"
Is there a preference that I can select which version of Excel that Numbers will export to?
In the meantime, I must abandon Numbers and use NeoOffice!Thanks,
I applied your suggested ISERROR transformation to examples such as:
=IFERROR(RANK(C47,$C47:$J47,1),"")
=IFERROR(MEDIAN(C51:C58),"")
=IFERROR($C32-C88+1,"")
However, a caution for young players....
Certainly, the ISERROR function exports to .xls. However, it behaves differently in NeoOffice.
Items 1 and 2 function identically in the case of say, ranking a row in which some cells are blanks.
Item 3, when translated using ISERROR to =IF(ISERROR(C32-C88+1),"", C32-C88+1), results in "" (ie error is raised) in Numbers but yields figure 0 in NeoOffice when there is a blank in either of the cells.
I recall from programming school in the mid-1970s that using GOTO statements and On Error branch statements were not admissible as routine programming steps. In fact, we received an automatic fail grade if we used a GOTO or GOTO like construction. So, I have found a more programmatically elegant way to solve my problem: eg:
=IF(C88="","",C32-C88+1)
Curiously, earlier I found/suspect this does not work equivalently in Numbers and NeoOffice:
=IF(ISBLANK(C88),"",C32-C88+1)
When you try using ISBLANK you always get an intuitively unexpected result because ISBLANK ONLY gives TRUE when there is absolutely nothing in a cell. A Formula reference in the cell, even if the function result yields "", gives FALSE... because, according to the definition of ISBLANK the cell contains a formula.
As I tell my students, ALWAYS lookup the HELP on any function you use. ALWAYS test the function to see how it performs!.... and lesson 3: Always test your spreadsheet on different systems.... then hope!
FYI:
Here's a link to my Spreadsheet (Neoffice .xls) and a video explaining its use.
Team Contribution: Introduction (Prototype). (2013). Retrieved from http://www.youtube.com/watch?v=bj87FGLoplk&feature=youtube_gdata_player
I don't guaranteee this link for ever! ... and I continue to "tweak" it
https://www.dropbox.com/s/1jz7gzksejnbqo1/Team%20Contribution.xls -
Numbers' Functions and Formulas in Multiple Cells, Tables, and Sheets
Hello,
I'm stuck with specifics that center around usage, and I get the funny feeling I'm overlooking a simple detail or two.
If I may, here goes.
I'm working with a single spreadsheet that has several sheets within it, and each sheet has an identical table. Each table is used to record various data, and I use an additional table in a separate sheet to consolidate some of the information, so that I can track results, at a glimpse, by looking at averages, totals, etc.
Each data table is organized for consolidation by tracking wins, ties, or losses. It is important to know that each data table only records a single win, tie, or loss along with its other applicable data. And on the actual consolidation table I am trying to tally specific data fields by the use of Numbers' functions and formulas, yet I wish to keep these tallied results organized by the determining factor of whether or not they were gathered from a table that recorded a win, a table that recorded a tie, or a table with a loss.
To illustrate, each table contains data fields that record start time, finish time, elapsed time, the day of the week, etc. Let's say I have eight tables, and the first two are winning tables, three more are tables that record a tie, and the last three are losing tables. For example, on my consolidated data table I wish to enter a function and formula capturing which of the eight tables are wins, ties, and losses so that I can, at a glance, see how much time elapsed to obtain the wins, ties, and losses. So then, in this example, for wins I want to determine which of those wins took 20 minutes, or which of them took 15 minutes, etc. So then, out of the two wins, let's say both of them took 20 minutes each. I need the numeral 2 to be counted and recorded on the consolidation table since only two tables match the criteria. And I would do the same for all remaining data fields (e.g., start time, finish time, etc.). Just so long as everything is determined by wins, ties, and losses, and then organized by the respective data fields. Simply put, this example determines a total of two wins that meet the data field requirement of 20 minutes. Out of the eight tables (one table per sheet) any other wins would then be organized according to the specific data in the elapsed time data field on it's data table (e.g., 5 minutes, 15 minutes, etc.).
The exact syntax structure of the functions and formula I'm unsuccessfully using follows below. It only seems to return a result of 1, and I think it is returning this value from the IF Statements. By the way, the Win, Tie, or Loss cell in each data table is cell formatted as a pop-up so I can either select None or 1. But in this example I'm basing this on the time period of 20 minutes, and out of the eight data tables I have two wins which also record the time period as 20 minutes, so I should see 2 and not 1 in the 20 minutes column of the consolidated data table. Also, I tried changing the syntax where I would type "=1" in the IF Statements, but it returned a result of =1, and if I don't include the equals sign and quotation marks the result just shows up as 1.
My Syntax:
IF(Trade 1::'Data Recorded (1)' '* Win', 1, IF(Trade 2::'Data Recorded (1)' '* Win',1, IF(Trade 3::'Data Recorded (1)' '* Win',1, IF(Trade 4::'Data Recorded (1)' '* Win',1, IF(Trade 5::'Data Recorded (1)' '* Win',1, IF(Trade 6::'Data Recorded (1)' '* Win',1, IF(Trade 7::'Data Recorded (1)' '* Win',1, IF(Trade 8::'Data Recorded (1)' '* Win',1, IF(COUNTIFS(Trade 1::'Data Recorded (1)' '* Time in Trade (in minutes)', "=20m")+COUNTIFS(Trade 2::'Data Recorded (1)' '* Time in Trade (in minutes)', "=20m")+COUNTIFS(Trade 3::'Data Recorded (1)' '* Time in Trade (in minutes)', "=20m")+COUNTIFS(Trade 4::'Data Recorded (1)' '* Time in Trade (in minutes)', "=20m")+COUNTIFS(Trade 5::'Data Recorded (1)' '* Time in Trade (in minutes)', "=20m")+COUNTIFS(Trade 6::'Data Recorded (1)' '* Time in Trade (in minutes)', "=20m")+COUNTIFS(Trade 7::'Data Recorded (1)' '* Time in Trade (in minutes)', "=20m")+COUNTIFS(Trade 8::'Data Recorded (1)' '* Time in Trade (in minutes)'))))))))))
Please bear in mind that the COUNTIFS portion of the above syntax structure is something I'm already successfully using to count the totals of other things not mentioned above, and I'm hesitant to delete it since it already works to my satisfaction when I want to, for example, determine the total number of overall wins. So, just for illustration purposes, I might have an overall wins column in my consolidation table that records how many wins there are, regardless of organization by elapsed time, or any other data field. In other words, the COUNTIFS syntax structure already works to my satisfaction. I'm not sure if it's possible to alter it so that it isn't so long, but what's there does work just when counting total numbers, as just mentioned.
In summary, I'm wondering which function I can use with the COUNTIFS function to determine which of my eight data tables are winning tables, but break those wins down further based on criteria like elapsed time, and in the above example the time elapsed is 20 minutes. As you may see above, I'm unsuccessfully using the IF function. Finally, I've looked at the function browser descriptions of things like LOOKUP, HLOOKUP, VLOOKUP, INTERSECT.RANGES, and a few others. And so far I haven't made good use of any of them the way I've done when I use the COUNTIFS function by itself when only counting overall totals. But now I must determine totals that meet certain criteria, as explained above.
Please help if you dare (smile). This is a huge project I'm undertaking, and so as not to cause confusion I have not included all of the details. But rather, I've taken a small sampling and set it to the side for experimentation. If this small sample works out to my satisfaction I can simply copy and paste the syntax in all other respective cells in the consolidation table, changing only reference locations, and perhaps conditions or values. One thing is certain, I don't intend on giving up on it.
Thank you for your time and advice.
Blessings!
Message was edited by: solo68
Added image.I'd like to edit the last paragraph of my second posting, but for some reason an entirely new posting is being created when I attempt to do this. So when reading this post, please use it to replace only the last paragraph of my second post containing the four inserted images.
Last paragraph begins:
In closing, I need each cell in each column of each row in my consolidation table to remain as is. I have my reasons for doing this, and they all serve a specific purpose. The only exception would be the formatting of the last three rows as footer rows. Most importantly, and I should have made this abundantly clear earlier, my apologies, I need a single function and formula in cell E7 of my consolidation table that will firstly determine which data tables are winning tables while secondly and simultaneously counting which of those winning tables have elapsed times of 20 minutes. Perhaps, now this better explains why my syntax is written the way it is written. In the example I provided, if the proper function and formula were written it would result as 2 in cell E7 in my consolidation table. If there is anything else specific you need of me in order to assist me, please request it. Thank you.
Last paragraph ends:
Additionally, to t quinn:
First off, thank you for returning to assist me. I really do appreciate your efforts. Please be aware that I'm avoiding going into details about each and every portion of my spreadsheet because I wish to avoid discussion that is off topic. As I stated earlier, I'm new to using these features of Numbers. My spreadsheet encompasses a much larger amount of data than I'm referring to in the example in my first post. But in my example I'm isolating just the information concerning what I'm now trying to accomplish to finish my spreadsheet project. Moreover, most of what I've done up to this point I was able to figure out on my own, or get help from watching videos on YouTube, or simply using the application help menu. Please be aware that I consulted all of these, repeatedly. I even contacted AppleCare, and was told this sort of support is not available. In spite of this, I've accomplished a great deal in my first large spreadsheet project. Please be aware that when I wrote my second post and specifically responded to you, I didn't want to be rude or ungrateful, and I still don't, but maybe the suggestions you and Hiroto made about gathering the count of wins, ties, and losses are something I've already done. I think I've done that separately. These counts are already in separate cells, and they are working fine. In my first post where I inserted only one image you can see examples of this in my consolidation table image, in cells B3 and E6. I apologize for not making this abundantly clear earlier. Furthermore, the portion of my syntax that shows the COUNTIFS is the exact way I accomplished this, and it is written the way it is written because I need separate sheets, each with their own data tables. Again, in cell E7 I need to determine which of the eight data tables that record wins are also recording 20 minutes, but I need this in a single function and formula with the result appearing only in cell E7. Once this is figured out I will adjust the syntax to do the same thing with every column (these are not shown but they exist) in my consolidation table for the last three footer rows, named Win Column Totals, Tie Column Totals, and Loss Column Totals. The last three rows being footer rows may not be necessary, and if so, I can convert them back to normal rows. Nonetheless, my consolidation table is counting the totals of all data in all data tables. This much I've already accomplished. Now I have one last function and formula I'm working on in order to determine which of the eight data tables record wins, ties, or losses while it simultaneously counts which of the wins, ties, or losses fall within certain categories like elapsed time, and this will be shown on my consolidation table only in the last three rows. Yes, I've gotten the total wins counted, and separately counted the total number of times 20 minutes was the elapsed time used, but so far, just looking at my consolidation table I don't know if the total number of times 20 minutes was used was with a win, tie, or loss. That's what I need to know now. Everything else is already accomplished. So then my consolidation table will show the totals for all data fields in my eight data tables as illustrated in cells B3 and E6. The last three rows of my consolidation table will break this down in a single function and formula with one row for wins, a second for ties, and a third for losses. And each of these respective last three rows will in the same function and formula determine if the win, tie, or loss also is one of the data fields in my eight data tables. How? By the use of columns in my consolidation table. Remember, each of my eight data tables are identical. In the example in my first post I only used one data field, elapsed time (Time in Trade), to illustrate in one column on my consolidation table what I'm trying to accomplish with all of the columns not shown in my consolidation table. Once this is figured out I can adjust it to complete the remainder of the consolidation table. Thank you, t quinn.
To all reading this and attempting to offer assistance, if for any reason I'm still not explaining myself clearly, please continue to ask me more specific questions. I realize it's hard to communicate this way, and if Apple allowed us to upload the actual spreadsheet it would make this entire forum a better place to communicate. But that's going off topic, so let's simply focus on the matter at hand. Thank you.
Blessings! -
Using Functions and/or Graphs with Custom Cell Formats in Numbers
I am attempting to use the AVERAGE function or create a graph in Numbers for cells with a custom format, however, I keep receiving an error message telling me that "Numbers can't be divided by Zero" or an empty graph.
The format I am using is for a split time for a certain distance, as in time it takes a runner to go around a track: minute:seconds.milliseconds i.e. 1:56.4
Is there a solution to the formatting or another way to accomplish having the correctly formatted cell and still be able to use functions and graphs.Hi nich.lee,
You can't chart Duration formatted data without first converting it to another format. Also, you will get an error if you attempt to use the AVERAGE function on an empty range.
Here's an example of charting Duration data by using a conversion...
Best regards,
Jerry -
Error message "ORA-01426: numeric overflow"
Could somebody please explain with me examples as when you get this error.
error message "ORA-01426: numeric overflow"
Thank You for your help.You get 1426 when a number, usually from a caclulation, is too big, or too small for Oracle to represent. For example:
SQL> SELECT POWER(99,99) FROM dual;
SELECT POWER(99,99) FROM dual
ERROR at line 1:
ORA-01426: numeric overflowwhich my calculator tells me is 3.6973E+197
TTFN
John -
SQL, PL/SQL functions, and ORA-04091 table is mutating
Dears,
Recently a question came up in an Oracle French forum about an insert/select that is throwing ORA-04091: table xxxx is mutating, trigger/function may not see it error in 11g while the same insert/select was working very well in 10g. The original poster gave a scenario that is easily reproducible. I am wondering what database release is correct the one throwing the error(11g) or the other one accepting the insert/select(10g)?
*10g*
mhouri.world > select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
mhouri.world > create table t_read_consistency (id number, vc varchar2(15), primary key (id));
Table created.
mhouri.world > insert into
2 t_read_consistency
3 select
4 rownum id,
5 rpad('a',15,'a')
6 from
7 dual
8 connect by
9 level<=1000;
1000 rows created.
mhouri.world > commit;
Commit complete.
mhouri.world > create or replace function f_read_consistency return varchar2
2 as
3 lv_vc t_read_consistency.vc%type;
4 begin
5 select trc.vc
6 into lv_vc
7 from t_read_consistency trc
8 where trc.id = 70 ;
9 return lv_vc;
10 end f_read_consistency;
11 /
Function created.
mhouri.world >insert into
2 t_read_consistency (id, vc)
3 select
4 1001
5 ,f_read_consistency
6 from dual;
,f_read_consistency
ERROR at line 5:
ORA-04091: table MHOURI.T_READ_CONSISTENCY is mutating, trigger/function may not see it
ORA-06512: at "MHOURI.F_READ_CONSISTENCY", line 5
_11g_
mohamed@mhouri> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
mohamed@mhouri> create table t_read_consistency (id number, vc varchar2(15), primary key (id));
Table created.
mohamed@mhouri> insert into
2 t_read_consistency
3 select
4 rownum id,
5 rpad('a',15,'a')
6 from
7 dual
8 connect by
9 level<=1000;
1000 rows created.
mohamed@mhouri> create or replace function f_read_consistency return varchar2
2 as
3 lv_vc t_read_consistency.vc%type;
4 begin
5 select trc.vc
6 into lv_vc
7 from t_read_consistency trc
8 where trc.id = 70 ;
9 return lv_vc;
10 end f_read_consistency;
11 /
Function created.
mohamed@mhouri> insert into
2 t_read_consistency (id, vc)
3 select
4 1001
5 ,f_read_consistency
6 from dual;
,f_read_consistency
ERROR at line 5:
ORA-04091: table MOHAMED.T_READ_CONSISTENCY is mutating, trigger/function may
not see it
ORA-06512: at "MOHAMED.F_READ_CONSISTENCY", line 5 So far so good. Same behaviour for both releases. But let's bring a small change to the PL/SQL function to be as close as the example given in the French Forum
_10g where the select/insert was working without error_:
mhouri.world > select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for Solaris: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
mhouri.world > create type t_read_cs as object (id number,vc varchar2(15));
2 /
Type created.
mhouri.world > create type t_read_cs_tab as table of t_read_cs;
2 /
Type created.
mhouri.world > create or replace function f_read_consistency_tab
2 return t_read_cs_tab
3 as
4 lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
5 j binary_integer := 0;
6 begin
7 for x in (select
8 id,
9 vc
10 from t_read_consistency trs
11 where trs.id <= 10
12 ) loop
13
14 j := j +1;
15 lc_t_read_cs_tab.extend;
16 lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
17 end loop;
18 RETURN lc_t_read_cs_tab;
19 end f_read_consistency_tab;
20 /
Function created.
mhouri.world > select count(1) from t_read_consistency;
COUNT(1)
1000
mhouri.world > select count(1)
2 from (select * from table(f_read_consistency_tab));
COUNT(1)
10
mhouri.world > insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab)
5 ;
10 rows created.
mhouri.world > select count(1) from t_read_consistency;
COUNT(1)
1010
_11g where the same insert/select is throwing an error:_
mohamed@mhouri> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
mohamed@mhouri> create type t_read_cs as object (id number,vc varchar2(15));
2 /
Type created.
mohamed@mhouri> create type t_read_cs_tab as table of t_read_cs;
2 /
Type created.
mohamed@mhouri> create or replace function f_read_consistency_tab
2 return t_read_cs_tab
3 as
4 lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
5 j binary_integer := 0;
6 begin
7 for x in (select
8 id,
9 vc
10 from t_read_consistency trs
11 where trs.id <= 10
12 ) loop
13
14 j := j +1;
15 lc_t_read_cs_tab.extend;
16 lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
17 end loop;
18 RETURN lc_t_read_cs_tab;
19 end f_read_consistency_tab;
20 /
Function created.
mohamed@mhouri> select count(1) from t_read_consistency;
COUNT(1)
1000
mohamed@mhouri> select count(1) from (select * from table(f_read_consistency_tab));
COUNT(1)
10
mohamed@mhouri> insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab)
5 ;
from table(f_read_consistency_tab)
ERROR at line 4:
ORA-04091: table MOHAMED.T_READ_CONSISTENCY is mutating, trigger/function may
not see it
ORA-06512: at "MOHAMED.F_READ_CONSISTENCY_TAB", line 7 In addition, one of the posters spotted out very judiciously that if we slightly change the definition of the table t_read_consistency in 11g, strangely the insert/select will work correctly in this data base as shown below:
ohamed@mhouri> drop table tr_read_consistency;
Table dropped.
mohamed@mhouri> create table tr_read_consistency
2 as select rownum rn,
3 trs.*
4 from
5 t_read_consistency trs;
Table created.
mohamed@mhouri> insert into tr_read_consistency
2 (rn, id,vc)
3 select rownum, id,vc
4 from table(f_read_consistency_tab);
10 rows created.So is this a regression? or a corrected bug during upgrade?
Thanks in advance
Mohamed HouriI just followed the doc links provided by Tubby, which have 100% Correct answer. See below :
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> show user;
USER is "SCOTT"
SQL> create type t_read_cs as object (id number,vc varchar2(15));
2 /
Type created.
SQL> create type t_read_cs_tab as table of t_read_cs;
2 /
Type created.
SQL> create table t_read_consistency (id number, vc varchar2(15), primary key (id));
Table created.
SQL> create or replace function f_read_consistency_tab
2 return t_read_cs_tab
3 as
4 lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
5 j binary_integer := 0;
6 begin
7 for x in (select
8 id,
9 vc
10 from t_read_consistency trs
11 where trs.id <= 10
12 ) loop
13 j := j +1;
14 lc_t_read_cs_tab.extend;
15 lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
16 end loop;
17 RETURN lc_t_read_cs_tab;
18 end f_read_consistency_tab;
19 /
Function created.
SQL> insert into
2 t_read_consistency
3 select
4 rownum id,
5 rpad('a',15,'a')
6 from
7 dual
8 connect by
9 level<=1000;
1000 rows created.
SQL> select count(1) from t_read_consistency;
COUNT(1)
1000
SQL> select count(1) from (select * from table(f_read_consistency_tab));
COUNT(1)
10
SQL> insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab);
from table(f_read_consistency_tab)
ERROR at line 4:
ORA-04091: table SCOTT.T_READ_CONSISTENCY is mutating, trigger/function may not see it
ORA-06512: at "SCOTT.F_READ_CONSISTENCY_TAB", line 7
SQL> ed
Wrote file afiedt.buf
1 create or replace function f_read_consistency_tab
2 return t_read_cs_tab
3 as
4 lc_t_read_cs_tab t_read_cs_tab := t_read_cs_tab();
5 j binary_integer := 0;
6 PRAGMA AUTONOMOUS_TRANSACTION; <--- This works as documented in 11.2.0.1
7 begin
8 for x in (select
9 id,
10 vc
11 from t_read_consistency trs
12 where trs.id <= 10
13 ) loop
14 j := j +1;
15 lc_t_read_cs_tab.extend;
16 lc_t_read_cs_tab(j) := t_read_cs(x.id, x.vc);
17 end loop;
18 RETURN lc_t_read_cs_tab;
19* end f_read_consistency_tab;
SQL> /
Function created.
SQL> insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab);
insert into t_read_consistency
ERROR at line 1:
ORA-00001: unique constraint (SCOTT.SYS_C0011307) violated
SQL> drop table t_read_consistency purge;
Table dropped.
SQL> create table t_read_consistency (id number, vc varchar2(15));
Table created.
SQL> insert into
2 t_read_consistency
3 select
4 rownum id,
5 rpad('a',15,'a')
6 from
7 dual
8 connect by
9 level<=1000;
1000 rows created.
SQL> commit;
Commit complete.
SQL> insert into t_read_consistency
2 (id,vc)
3 select id,vc
4 from table(f_read_consistency_tab);
10 rows created.
SQL> commit;
Commit complete.
SQL>So, you have to add only PRAGMA AUTONOMOUS_TRANSACTION; before begin in your function code to avoid ORA-04091 in 11.2.0.1
But, All thanks to Tubby who pointed us to the correct documentation link.
Regards
Girish Sharma -
Function giving numeric overflow
When i call this function with parameter-
6244628707
i get this error-numeric overflow.
CREATE OR REPLACE FUNCTION TATA_ICR.isprime (p_number NUMBER)
RETURN NUMBER
IS
BEGIN
IF p_number = 3 or p_number=1
THEN
RETURN 1;
END IF;
FOR i IN 3 .. p_number - 1
LOOP
IF MOD (p_number, i) = 0
THEN
RETURN 0;
END IF;
END LOOP;
RETURN 1;
END;
/Well, see the example and read the documentation!.
SQL> BEGIN
2 --The limit of BINARY_INTEGER/PLS_INTEGER is 2,147,483,647
3 FOR i IN 1..2147483648 LOOP --1 added to the upper limit.
4 NULL;
5 END LOOP;
6 END;
7 /
BEGIN
ERROR at line 1:
ORA-01426: numeric overflow
ORA-06512: at line 3
SQL> This is something do with this statements in the documentation
indexName for the implicitly declared integer variable that is local to the FOR LOOP statement. Statements outside the loop cannot reference index. Statements inside the loop can reference index, but cannot change its value. After the FOR LOOP statement runs, index is undefined. -
Plug-in for bullets and numbered lists in Mail??
Does anyone know of any plug-ins for the Mail app to do bullets and numbered lists like Entourage??
The lack of this functionality really makes Mail kinda lame and unusable for me.
Thanks!Paul,
the fact that Mail does not support bullit lists is not an oversight but was done on purpose. It may look good on your computer when you compose the message, but you have little influence in the way recipients see that message. It can get very messy, I can assure you.
If you want a perfect layout, compose in a wordprocessor and save as PDF, send that as an attachment. -
Hi All,
I have a function and a column with same name. No parameter passing into the function but function return type is number. I have a column name same as function name and datatype also number. In my query i want to use the return result of function when i am selecting from the table which have the column.
Can any body tell me how to do. Both are in same user.
Thanks in Advance
RkI've always known the French were weird, but shift for a period?That's not all, its shift for all the numbers too and a bunch of letters are swapped.
http://www.forlang.wsu.edu/help/kfrench.gif
I first used unix and vi on a French system, spent all my time looking down at the keyboard and couldn't understand why I kept deleting the wrong character when switching from insert to edit mode after making a typo of which there were plenty.
Finally I caught the cursor moving back one space when in edit mode, I have hated vi ever since. -
Using HS.Exp function to write data to a Consolidated Account
Hi,
Just wanted to know whether i can use the HS.Exp function to write data to a consolidated account?
ThanksHi Mau,
In order to write data to a consolidated account, you can use HS.Exp function in rules which puts data into a combination of Account, ICP, and Custom1...4 members. The syntax is: HS.Exp "DestPOV = Expression"
You might find useful the HS.Con function which puts data into the [Proportion] and [Elimination] Value dimension members and can also be used in Consolidation rules. The syntax is: Call HS.Con ("V#[Elimination]",-1*dPCon,"")
Regards,
Thanasis
Maybe you are looking for
-
How to enable Billing plan tab in sales order (lean) with NWBC
Dear All, The Billing plan tab in sales order (lean) is not availabe with NWBC. How to enable this tab? Is there is any documentation to do the modifications of NWBC's webdynpro screens? for example, there is a standard webdynpro screen in NWBC from
-
Need to re-install Leopard but won't work with Retail Disks
Hi I have a Macbook 2.0Ghz (santa rosa) with a few problems (poor ethernet performance, poor open gl performance) I have decided it will be best to re-install to see if that fixed the problems, however I have lost the install disks that came with the
-
I wanted to ask if anyone using a Mac Pro running Mountain Lion, Parallels 8, and Windows 7 Pro could run XP Mode? My experience has not been encouraging in that I progress to the end of the final mile, that is configuring XP Mode for first use, the
-
Viewing image dimensions in Finder
This may be an obvious question, but how can I view the pixel dimensions of images in Finder? I am new to the mac platform and I know in windows you can simply hover over the thumbnail in Explorer and it would tell you the dimensions of the image. Th
-
Hello, I am a network professional working in the past 20 years supporting Novell and Microsoft OS and applications. Now I am looking for a path to start a different career. I have chosen SAP system to start the new career, but I got many questions b