Mutating Problem when insert while selecting data from dual
Hi All,
we have a table
test (
ID NUMBER
NAME VARCHAR2(100)) and a before insert trigger
create or replace trigger test1
before insert on test
for each row
begin
select decode(max(id),null,1,max(id)+1) into :new.id from test;
end;
i am able to insert values by using
"insert into test(name) values('test1')" with out any issues.
when i am inserting the values
"insert into test(name) select 'test1' from dual" i am getting error
ORA-04091: table SCOTT.TEST is mutating, trigger/function may not see it
Could someone please advice why i am getting error in second scenario.
Thanks in Advance
Prasad
Prasad
try
insert into test (name) values ((select 'test1' from dual));
Frank
Similar Messages
-
Error while selecting date from external table
Hello all,
I am getting the follwing error while selecting data from external table. Any idea why?
SQL> CREATE TABLE SE2_EXT (SE_REF_NO VARCHAR2(255),
2 SE_CUST_ID NUMBER(38),
3 SE_TRAN_AMT_LCY FLOAT(126),
4 SE_REVERSAL_MARKER VARCHAR2(255))
5 ORGANIZATION EXTERNAL (
6 TYPE ORACLE_LOADER
7 DEFAULT DIRECTORY ext_tables
8 ACCESS PARAMETERS (
9 RECORDS DELIMITED BY NEWLINE
10 FIELDS TERMINATED BY ','
11 MISSING FIELD VALUES ARE NULL
12 (
13 country_code CHAR(5),
14 country_name CHAR(50),
15 country_language CHAR(50)
16 )
17 )
18 LOCATION ('SE2.csv')
19 )
20 PARALLEL 5
21 REJECT LIMIT UNLIMITED;
Table created.
SQL> select * from se2_ext;
SQL> select count(*) from se2_ext;
select count(*) from se2_ext
ERROR at line 1:
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04043: table column not found in external source: SE_REF_NO
ORA-06512: at "SYS.ORACLE_LOADER", line 19It would appear that you external table definition and the external data file data do not match up. Post a few input records so someone can duplicate the problem and determine the fix.
HTH -- Mark D Powell -- -
Probel while selecting data from table
Hi,
As per my below code i want to select data from table AFKO where PLNBEZ = it_mat-matnr, and GETRI IS BLANK , but data is not comingin IT_AFKO
**********************CODE
select AUFNR RSNUM GAMNG PLNBEZ From AFKO into table it_afko for all entries in it_mat
where PLNBEZ = it_mat-matnr
and GETRI = ' '.
regards,
zafarHi,
Try below code
select AUFNR RSNUM GAMNG PLNBEZ From AFKO into table it_afko for all entries in it_mat
where PLNBEZ = it_mat-matnr
and GETRI = '00000000'.
Hope you need the records for which GETRI is not updated.
Regards
Vinod -
How to insert decimal point while selecting data from a table
Hi All ,
My select requirement says , If the value received with no decimal then insert decimal before last 2 bytes. I need to retrieve data with this condition.
May you people help how i can achieve this?
Thanks in advance,
SachetanIs the data a number in string format?
with q as (select '12345' myNum from dual
union all select '45.78' from dual)
select case when instr(myNum, '.') > 0 then to_number(myNum) else
to_number(substr(myNum, 1, length(myNum) - 2) || '.' ||
substr(myNum, length(myNum) - 1)) end newNum from q
NEWNUM
123.45
45.78If not just use
with q as (select 12345 myNum from dual
union all select 45.78 from dual)
select case
when instr(myNum,'.')>0 then myNum
else myNum/100
end myNum
from q
MYNUM
123.45
45.78 -
Problem while selecting data from external tables
Hi All,
I am facing a problem with external tabels. I have created an external table
create table ext_org_table
( id varchar2(10)
, name varchar2(100)
,id_parent varchar2(10)
,name_parent varchar2(100))
organization external
( type oracle_loader
default directory MYDIR
access parameters
records delimited by newline
nologfile
nobadfile
fields terminated by ','
missing field values are null
location ('Orgdata.csv')
reject limit unlimited;
The problem is that when i give select * from ext_org_table , i get following error
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-04040: file Orgdata.csv in MYDIR not found
ORA-06512: at "SYS.ORACLE_LOADER", line 19
ORA-06512: at line 1
Now , i have file Orgdata.csv in the specified directory.
I have created directory in oracle using create directory command.
I have granted read,write permission on the directory to user.
I have given all read,write and execute permissions to folder where my files resides.My file resides in /appl/home/kk
Now i don't understand why it is giving error file in Mydir not found.
Kindly suggest.
Regards
KrishHi,
You are obviously doing someting wrong.
May be the direcotry is not present or may be the file is not rpesent in the directory.
I just tried ths
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
Connected as SYS
create directory mydir as 'c:\csv';
grant read,write on directory mydir to scott;From Scott
create table ext_org_table
( id varchar2(10)
, name varchar2(100)
,id_parent varchar2(10)
,name_parent varchar2(100))
organization external
( type oracle_loader
default directory MYDIR
access parameters
records delimited by newline
nologfile
nobadfile
fields terminated by ','
missing field values are null
location ('Orgdata.csv')
reject limit unlimited;
select * from ext_org_table;Ofcourse i made up some dummy data to test and its all OK.
again,
You may want to check if
1) If the directory exists (select * from all_directories where directory_name='MYDIR');
2) If the user has the read/write permissions on that directory
3) If the file orgdata exists in that directory.
Regards,
Bhushan -
Dump while selecting data using ranges
Hi everybody,
I am using ranges to select data from BSEG table.
In a particular case the ranges table contains around 7000 entries, hence it leads to a short dump. Is there any limitation associated with ranges? with fewer number of entries it works fine. The code is already optimized properly for performance tuning purposes. There are no duplicate entries in ranges table i.e. all 7000 entries are unique and all are with sign as 'I' and option as 'EQ' , so all entries are unique single values.
Apart from this I have another query also. While selecting data from BSEG / CATSEKKO table if I use for all entries, then complete data is not fetched, However when I use ranges for same set of values, the missing records are also fetched. Any ideas for this behavior ? Is this related to cluster / pooled / transparent table types?
Thanks,
Harmeet Singh.Hello,
I am using ranges to select data from BSEG table.
In a particular case the ranges table contains around 7000 entries, hence it leads to a short dump. Is there any limitation associated with ranges? with fewer number of entries it works fine. The code is already optimized properly for performance tuning purposes. There are no duplicate entries in ranges table i.e. all 7000 entries are unique and all are with sign as 'I' and option as 'EQ' , so all entries are unique single values.
i have already encoutered problem using range in SELECT statement. TO avoid the SELECT statement to dump, i have changed my SELECT statement : FOR ALL ENTRIES instead using range.
+Apart from this I have another query also. While selecting data from BSEG / CATSEKKO table if I use for all entries, then complete data is not fetched, However when I use ranges for same set of values, the missing records are also fetched. Any ideas for this behavior ? Is this related to cluster / pooled / transparent table types?+
Could you show us the SELECT statement ?
Cordialement,
Chaouki AKIR. -
I have set-up an ECT in SPD2013 on SP2013. It is a SQL Data source called ProjectWebApp. I have BCS/SSS set-up. I can create an ECT OK in SPD. I can add the ECT to a custom list.
The problem is when I add a new item in the list the following error message appears in red
An error occurred while retrieving data from ProjectWebApp. Administrators, see the server log for more information
I cannot filter or return any results. There is data in the DB.
Another test I do is to try and create a new App/List using the "External List" template. When
I select the ECT a red message appears "External Content Types are not available". which is odd since I can add an ECT to a list as mentioned above.
Any ideas?
Tx
Andrew
Andrew PayzeHi Andrew,
Please try the option Allow unlimited length in document libraries in the column settings:
http://littletalk.wordpress.com/2011/08/18/external-content-type-an-error-occurred-while-retrieving-data-from-a-system-administrators-see-the-server-log-for-more-information/
If it doesn't help, please refer to the link below and raise the External content type Read List operation thresholds:
http://lightningtools.com/bcs/business-connectivity-services-end-user-implications-part-one-threshold-limit-errors/
Please provide error message in ULS log for further troubleshooting.
Regards,
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected] .
Rebecca Tu
TechNet Community Support -
Problem while loading data from ODS to infoobject
Hi guys,
I am facing problem while loading data from <b>ODS to infoobject</b>.
If I load data via PSA it works fine but
if I load data without PSA its giving error as Duplicate records.
Do u have any idea why it is so.
Thanks in advance
savioHi,
when you load the data via the PSA, what did you select? Serial or Paralel?
If you select serial most likely you don't have duplicates within the same datapackage and your load can go through.
Loading directly in the IObj will happen thefore if you have the same key in two different packages, the "duplicate records" will be raised; you can perhaps flag your IPack with the option "ignore duplicate records" as suggested...
hope this helps...
Olivier. -
Problem while retrving data from a view
Hi Friends
i have a problem while retriving data from a view <b>v_t685a</b>.
the error message is :""" "V_T685A" is not defined in the ABAP Dictionary as a table, projection view or database view."""
i wrote : select single VTEXT1 from V_T685A into w_cst_jin1 where
KSCHL = 'JIN1' and
KAPPL = 'V'.
how to retrive the data.
waiting for quick response
Regards
MukeshHi
This is a Maintenance View, not a Database View
SO can't fetch data using select statement.
You can use the Table <b>T685</b> directly to fetch the condition Types data straight away instead of the view. write the same select for this table and use.
Regards
Anji
Message was edited by:
Anji Reddy Vangala -
Hi Friends,
I am using Oracle 8.1.6 Server, & facing problems while retrieving data from a PL/SQL Table:
CREATE or REPLACE PROCEDURE test_proc IS
TYPE tP2 is TABLE of varchar2(10); --declared a collection
dt2 tP2 := tP2('a','b','c');
i NUMBER(8);
begin
SELECT COUNT(*) INTO i FROM TABLE(CAST(dt2 as tP2));
DBMS_OUTPUT.PUT_LINE('**'||i);
end;
While executing the above procedure, I encountered foll. error:
ERROR at line 1:
ORA-00600: internal error code, arguments: [15419], [severe error during PL/SQL execution], [], [],
ORA-06544: PL/SQL: internal error, arguments: [pfrrun.c:pfrbnd1()], [], [], [], [], [], [], []
ORA-06553: PLS-801: internal error [0]
Can anyone please help me, where the problem is??
Is it Possible to retrieve data from PL/SQL TABLE using SELECT statement? & How ?
Thanks in advance.
Best Regards,
Jay Raval.Thanks Roger for the Update.
It means that have to first CREATE TYPE .. TABLE in database then only I can fire a Select statement on that TYPE.
Actually I wanted to fire a Select statement on the TABLE TYPE, defined & declared in PLSQL stored procedure using DECLARE TYPE .. TABLE & not using CREATE TYPE .. TABLE.
I was eager to know this, because my organization is reluctant in using CREATE TYPE .. TABLE defined in the database, so I was looking out for another alternative to access PL/SQL TABLE using Select statement without defining it database. It would have been good if I could access a PLSQL TABLE using Select statement Declared locally in the stored procedure.
Can I summarize that to access a PL/SQL TABLE using SELECT statement, I have to first CREATE TYPE .. TABLE?
If someone have any other idea on this, please do let me know.
Thanks a lot for all help.
Best Regards,
Jay Raval.
You have to define a database type...
create type tP2 is table of varchar2(10)
CREATE OR REPLACE PROCEDURE TEST_PROC
IS
dt2 tP2 := tP2('a','b','c');
i NUMBER(8);
begin
SELECT COUNT(*) INTO i FROM TABLE(CAST (dt2 AS tP2));
DBMS_OUTPUT.PUT_LINE('**'||i);
end;
This will work.
Roger -
Why select data from Function directly (SE37) got data , but when use funct
why select data from Function directly (SE37) got data , but when use function in program donot found data
i use function
CS_BOM_EXPL_MAT_V2
when i run function directly at SE37 .
i found data.
but when i use same function in program .
system not found.
please see my attachment.
help me please.
[http://www.quickfilepost.com/download.do?get=c974356a498b3a4d369aa0c50622e50b]
http://www.quickfilepost.com/download.do?get=c974356a498b3a4d369aa0c50622e50bI know why U get empty data.
In Program U should follow the rules:
U'd better data a variant typed the function parameters's type.
for example:
in your program the parameter: stlal = '1'
U'd better like follow:
Data l_stlal type STKO-STLAL
l_stlal = '01'. *Attention: '1' <> '01'.
stlal = l_stlal.
in this way U may have less mistake
and the parameter MTNRV
U should use material convernt : "CONVERSION_EXIT_MATN1_INPUT" to change material into internal types before U put into function's parameter.
why se37 has no problem? because In se37, the data you filled was be processed before use -
Problem while reading data from Serial Port
Hi All,
I am facing some problem while reading data from Serial Port.
As per the requirement I am writing the data on Serial Port and waiting for response of that data.
Notification for data availabilty is checked with method public void serialEvent(SerialPortEvent event) of javax.comm.SerialPortEventListener.
When we are writing data on the port one thread i.e. "main" thread is generated and when data availability event occures another thread "Win32SerialPort Notification thread" is generated. This creates problem for me as we can't control thread processing.
So can anybody pls explain me how to overcome this problem?
Regards,
NehaMy Problem is:-
I am simoultaneouly wrting data on port & reading data from port.
First I write data on port using outputStream.write() method. Now when target side sends me response back for the request on serial port DATA_AVAILABLE of SerialPortEventListner event occured,we are reading data from serial port.Now till the time we didn't get the response from target next command can't be written on the serial port. When we are writing data on port main thread is executed.Now my problem starts when DATA_AVAILABLE event occured.At this point another thread is created.Due to this my program writes data of next command without reading response of previous command.To solve this prob. I have used wait() & notify() methods as follows.But again due to this my pc hangs after execution of 2 commands. (PC hang in while loop in a code provided below.)
From SOPs I could figure it out that after 2 commands we are not able to write data on serial port so DATA_AVAILABLE event doesn't occure n pro. goes in wait state.
Can anybody help me to solve this issue.
Neha.
Code:
public void serialEvent(SerialPortEvent event)
switch (event.getEventType())
case SerialPortEvent.BI:
case SerialPortEvent.OE:
case SerialPortEvent.FE:
case SerialPortEvent.PE:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.RI:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;
case SerialPortEvent.DATA_AVAILABLE:
try
dataThread = Thread.currentThread();
dataThread.setPriority(10);
dataAvailable = true;
byte[] tempArray=new byte[availableBytes];
inputStream.read(tempArray);
catch (IOException io)
SOP(io, "Error in serialEvent callback call for event DATA_AVAILABLE");
public void writetoPort(byte[] data) throws IOException
outputStream.write(data);
while(finalTimeOut >= actualTime)
if( ! dataAvailable)
actualTime = System.currentTimeMillis();
else
synchronized (mainThread)
mainThread = Thread.currentThread();
mainThread.wait();
public void sendDatatoUser(byte[] b) throws Exception, HWCCSystemFailure
obj.returnData(b);
synchronized(mainThread)
mainThread.notify();
-
Incorrect year conversion when selecting date from DatePicker
Hi,
I have a problem when I select date from the date picker calendar to the inputDate item.
The date in input item and date picker calendar are displayed as Buddhist year (Gregorian year + 543) ex. year 2012 is 2555 Buddhist year.
When I selected date from the date picker, the year put in the inputDate item is converted to Gregorian year (2012). It should be buddhist year (2555)
Does anybody know where I can check how the year is converted?
Thanks.
nat...Hi Bijesh,
I use version 11.1.2.2.0. Actually, I got the patch from Oracle support already but it is not working properly with my application. The behavior is like this...
- First, I set the current date as a default date in the inputDate item and date is shown correctly -- 10/10/2555.
- The calendar in datePicker is also displayed correctly with year 2555.
- But when I selected the date from the datePicker, it put 10/10/2012 in the inputDate item.
I am not sure where I can check how the year is converted back to Gregorian. Any clue?
Thanks.
nat... -
How to select data from 3rd row of Excel to insert into Sql server table using ssis
Hi,
Iam having Excel files with headers in first two rows , i want two skip that two rows and select data from 3rd row to insert into Sql Server table using ssis.3rd row is having column names.CUSTOMER DETAILS
REGION
COL1 COL2 COL3 COL4 COL5 COL6 COL7
COL8 COL9 COL10 COL11
1 XXX yyyy zzzz
2 XXX yyyy zzzzz
3 XXX yyyy zzzzz
4 XXX yyyy zzzzz
First two rows having cells merged and with headings in excel , i want two skip the first two rows and select the data from 3rd row and insert into sql server using ssis
Set range within Excel command as per below
See
http://www.joellipman.com/articles/microsoft/sql-server/ssis/646-ssis-skip-rows-in-excel-source-file.html
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
Eliminate duplicate while fetching data from source
Hi All,
CUSTOMER TRANSACTION
CUST_LOC CUT_ID TRANSACTION_DATE TRANSACTION_TYPE
100 12345 01-jan-2009 CREDIT
100 23456 15-jan-2000 CREDIT
100 12345 01-jan-2010 DEBIT
100 12345 01-jan-2000 DEBITNow as per my requirement, i need to fetch data from CISTOMER_TRANSACTION table for those customer which has transaction in last 10 years. In my above data, customer 12345 has transaction in last 10 years, whereas for customer 23456, does not have transaction in last 10 years so will eliminate it.
Now, CUSTOMER_TRANSACTION table has approximately 100 million records. So, we are fectching data in batches. Batching is divided into months. Total 120 months. Below is my query.
select *
FROM CUSTOMER_TRANSACTION CT left outer join
(select distinct CUST_LOC, CUT_ID FROM CUSTOMER_TRANSACTION WHERE TRANSACTION_DATE >= ADD_MONTHS(SYSDATE, -120) and TRANSACTION_DATE < ADD_MONTHS(SYSDATE, -119) CUST
on CT.CUST_LOC = CUST.CUST_LOC and CT.CUT_ID = CUST.CUT_IDThru shell script, months number will change. -120:-119, -119:-118 ....., -1:-0.
Now the problem is duplication of records.
while fetching data for jan-2009, it will get cust_id 12345 and will fetch all 3 records and load it into target.
while fetching data for jan-2010, it will get cust_id 12345 and will fetch all 3 records and load in into target.
So instead of having only 3 records, for customer 12345 it will be having 6 records. Can someone help me on how can i eliminate duplicate records from getting in.
As of now i have 2 ways in mind.
1. Fetch all records at once. Which is impossible as it will give space issue.
2. After each batch, run a procedure which will delete duplicate records based on cust_loc, cut_id and transaction_date. But again it will have performance problem.
I want to eliminate it while fetching data from source.
Edited by: ace_friends22 on Apr 6, 2011 10:16 AMYou can do it this way....
SELECT DISTINCT cust_doc,
cut_id
FROM customer_transaction
WHERE transaction_date >= ADD_MONTHS(SYSDATE, -120)
AND transaction_date < ADD_MONTHS(SYSDATE, -119)However please note that - if want to get the transaction in a month like what you said earlier jan-2009 and jan-2010 and so on... you might need to use TRUNC...
Your date comparison could be like this... In this example I am checking if the transaction date is in the month of jan-2009
AND transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27) AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27)) Your modified SQL...
SELECT *
FROM customer_transaction
WHERE transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27) AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27))Testing..
--Sample Data
CREATE TABLE customer_transaction (
cust_loc number,
cut_id number,
transaction_date date,
transaction_type varchar2(20)
INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2009','dd-MON-yyyy'),'CREDIT');
INSERT INTO customer_transaction VALUES (100,23456,TO_DATE('15-JAN-2000','dd-MON-yyyy'),'CREDIT');
INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2010','dd-MON-yyyy'),'DEBIT');
INSERT INTO customer_transaction VALUES (100,12345,TO_DATE('01-JAN-2000','dd-MON-yyyy'),'DEBIT');
--To have three records in the month of jan-2009
UPDATE customer_transaction
SET transaction_date = TO_DATE('02-JAN-2009','dd-MON-yyyy')
WHERE cut_id = 12345
AND transaction_date = TO_DATE('01-JAN-2010','dd-MON-yyyy');
UPDATE customer_transaction
SET transaction_date = TO_DATE('03-JAN-2009','dd-MON-yyyy')
WHERE cut_id = 12345
AND transaction_date = TO_DATE('01-JAN-2000','dd-MON-yyyy');
commit;
--End of sample data
SELECT *
FROM customer_transaction
WHERE transaction_date BETWEEN ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27) AND LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE,'MONTH'), -27));Results....
CUST_LOC CUT_ID TRANSACTI TRANSACTION_TYPE
100 12345 01-JAN-09 CREDIT
100 12345 02-JAN-09 DEBIT
100 12345 03-JAN-09 DEBITAs you can see, there are only 3 records for 12345
Regards,
Rakesh
Edited by: Rakesh on Apr 6, 2011 11:48 AM
Maybe you are looking for
-
Can't restore iLife after reinstalling Mountain Lion
After I erase the internal disk and reinstall Mountain Lion, I followed this instruction which Apple provides officially to restore my iLife: Restoring iLife applications after Internet Restore of OS X Lion or OS X Mountain Lion If you erase install
-
Convert photostory1.wmv to .mov
A friend still creates a 5 minute photo/music slideshow using photostory1 every month. She does not want to change to any other software. I have tried most every conversion method found in this community and from other places. I have not been able to
-
Error in retrieving user list for a particular group in CMC (BOXI R2)
The following error message is shown "There was an error while retrieving data from the server: Failed while trying to get role member list using class CSecRfcRemoteUsersActGrp in method CSecSAPR3Binding::GetChildrenInternal(). Error code: 2. Descrip
-
La connection wifi fonctionne mal Wifi connection fails
The wifi connection does not work (after working perfectly). I cannot read or send mails and go to the internet. But it works fine with an ethernet cable. Yesterday, I reinstall Yosemite. It allows me to restore a good wifi connection. But after on
-
I'm a Korean living in Dubai. I have big I & small I and try to buy Mac Air also. I contact Apple store Korea and asking delivery Dubai aftter online purchase order made. Howevery one of sales support team denied and it's no possible under Apple poli