JDBC Receiver adapter Error for insert into DB2 table
Hi all,
I want to insert data into a DB2 table on AS400 via a Receiver JDBC adapter.
The communication channel seems to be ok but when I try to send the message, I obtain the following message on the adapter monitoring :
Error: TransformException error in xml processor class, rollback:
Error processing request in sax parser: Error when executing statement for table/stored proc. 'GIK.GDT01' (structure 'Statement'): java.sql.SQLException: La table GDT01 de la bibliothèque GIK est incorrecte pour cette opération.
Could someone help me?
In the communication channel I have seen we can choose "native SQL String" as message protocol.
Do you think it could be a workaround for me? if yes, could someone send me an example about it?
thanks a lot,
Philippe
Hi,
Try to remove GIK.GDT01 in table tag of your XML structure and put GDT01 alone and see.
The solution to your problem is found on this particular link.
http://www.websina.com/bugzero/faq/exception-as400.html
Tell me if it works
Best regards,
Felix
Similar Messages
-
Hi All,
I am executing SP by using JDBC Receiver Adapter.
My strcture is follows
<STATEMENT2>
<SP_CREATE_T_BATCH action="EXECUTE">
<spName type="VARCHAR">SP_CREATE_T_BATCH</spName>
<IN_Control_Recipe hasQuot="No" type="Integer">100000000001723850</IN_Control_Recipe>
</SP_CREATE_T_BATCH>
</STATEMENT2>
The below error I am getting
Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_CREATE_T_BATCH' (structure 'STATEMENT2'): java.lang.NumberFormatException: For input string: "100000000001723850"
Any help on thisHi Ram,
Since you mentioned that your SP has one input parameter and one output parameter, the structure of the XML message at the JDBC receiver side should be:
<STATEMENT2>
<SP_CREATE_T_BATCH action="EXECUTE">
<IN_Control_Recipe isInput="true" hasQuot="No" type="BIGINT">100000000001723850</IN_Control_Recipe>
<Output_Parameter isOutput="true" type="SQLDataType"></Output_Parameter>
</SP_CREATE_T_BATCH>
</STATEMENT2>
Here, i have assumed the following:
SP_CREATE_T_BATCH - The name of the Stored Procedure to be executed
IN_Control_Recipe - Input parameter of the SP and its SQLDataType is BIGINT as suggested by Stefan.
Output_Parameter - Output parameter of the SP. You may enter the SQL data type as per the output of your Stored Procedure.
The following SQL data types are supported:
INTEGER, BIT, TINYINT, SMALLINT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, CHAR, VARCHAR, STRING, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, BLOB (input and output),CLOB (input and output), CURSOR (output; only in conjunction with the Oracle JDBC driver).
Hope this will surely solve your problem.
Regards, Gaurav. -
JDBC Receiver Adapter Error with SAPClassNotFoundException
HI Friends,
I have configured the JDBC Receiver Adapter with parameters as
Driver: oracle.jdbc.driver.OracleDriver
Connection: jdbc:oracle:thin:@10.15.96.29:1525:RMOSDB
XI 700, Oracle DB 10.2
I have installed JDBC driver for Oracle as guide How Install and Configure External Drivers for the JDBC & JMS Adapters.pdf. I can see file ojdbc14.jar at D:\usr\sap\<SID>\DVEBMGSNN\j2ee\cluster\server0\bin\ext\com.sap.aii.af.jmsproviderlib.
But Im still getting an error SAPClassNotFoundException as following:
#XI AF com.sap.aii.adapter.jdbc.XI2JDBC@1497c21##0#0#Error#1#com.sap.aii.adapter.jdbc.XI2JDBC#Plain###Accessing database connection 'jdbc:oracle:thin:@10.15.96.29:1525:RMOSDB' failed: com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:oracle:thin:@10.15.96.29:1525:RMOSDB': SAPClassNotFoundException: oracle.jdbc.driver.Oracledriver#
#XI AF com.sap.aii.adapter.jdbc.XI2JDBC@1497c21##0#0#Error#1#com.sap.aii.adapter.jdbc.XI2JDBC#Plain###JDBC_ERR_207#
#Error#1#com.sap.aii.adapter.jdbc.XI2JDBC#Plain###Accessing database connection 'jdbc:oracle:thin:@10.15.96.29:1525:RMOSDB' failed: com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:oracle:thin:@10.15.96.29:1525:RMOSDB': SAPClassNotFoundException: oracle.jdbc.driver.Oracledriver#
I tried to install JDBC driver again but it was not solve this problem.
Please suggest!
Regards,
CuongHI Cuong,
It seems something wrong with the installation of JDBC driver or in the config parameters for Adapter.
Not sure if driver is case sensitive.
But from the log it shows "oracle.jdbc.driver.Oracledriver".
Try putting "oracle.jdbc.driver.OracleDriver".
regards,
Pinkle -
Creating a button for inserting into a table
What I can't do, because I've never needed to, is to create in a page (where I have a Interactive report) a button that when is clicked performs a simple sql (for example an insert into a table using some page item values).
How can I do it?
ThanksHere are some of the steps:
1) Create the button.
2) Then right click on the button name and select Create Dynamic Action
3) Give the DA a name, click next
4) On the "When" Step, Event should already be "Click" and the button name should be filled in
5) For Condition, you would have a condition for when you want the button display. Say, if your page items have a certain range of values then display this button. No condition means the button is always displayed.
6) For the "True Action" Step, for Action select "Execute PL/SQL Code"
[There are other ways to do this, but this is straight-forward for me.]
7) The in the PL/SQL Code block enter say:
Begin
INSERT INTO EMP (EMPNO, ENAME, HIREDATE)
VALUES (:P6_EMPNO, 'MARK1970', :P6_HIREDATE);
COMMIT;
END; --- You would likely make them all page item variables
8) Here the part I'm not 100% sure of.
For "Page Items to Submit", name the page items used in YOUR QUERY -- in my example these are P6_EMPNO,P6_HIREDATE (Note no use of & or : or . here)
Hmm. Start by putting nothing in the "Page Items to Return". If that fails, then try the same page items P6_EMPNO,P6_HIREDATE there as well.
[ I'm too lazy to go run this down at the moment.]
9) I think that's it.
Howard -
IDOC to JDBC receiver adapter: SQLServerException after INSERT
Hello,
we are using SAP XI 3.0 and I have to set up an asynchronous IDOC to JDBC scenario.
Informations coming via IDOC have to be inserted into an MS SQL database. The ID for each dataset will be set automatically when inserting, so there is no update. I have used the following structure:
When sending an IDOC, the data will be inserted into the database, but in the Runtime Workbench the following Exception occurs:
' SQLServerException. A result set was generated for update. '
It seems to me, that the result information of the database can't be handled in the JDBC adapter.
Anybody an idea if this is a issue on the XI or maybe of the database itself?
Thanks in advance.
Jürgen
Edited by: Juergen Grallert on May 11, 2009 11:17 AMhi,
try setting logSQLStatement as described in OSS note 801367
to see what get executed in the statement and you will know
what to change in XI then - this is the proper way to debug jdbc issues
Regards,
Michal Krawczyk -
ORA-01403: no data found error hile inserting into a table
Hi,
I am populating a PL/SQL table(Array) with the data. From that array inserting into a Actual table. Before inserting am checking array count. Array count is greater than 0. But I am getting "ORA-01403: no data found" exception. I am not getting why this error is displaying.
Please someone help me. Below is the code.
CREATE OR REPLACE PROCEDURE XXDL_TEST_INSERT
IS
BEGIN
IF t_array.count> 0 THEN
FND_FILE.PUT_LINE (FND_FILE.LOG, t_array.count);
FOR i IN t_array.FIRST..t_array.LAST
LOOP
INSERT INTO XXDL_TEST
VALUES(t_array(i).name )
END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
FND_FILE.PUT_LINE (FND_FILE.LOG,SQLERRM);
END;Thanks
AlakaIt looks like your Array is sparsely populated:
SQL> DECLARE
2 TYPE l_tab_type IS TABLE OF VARCHAR2(10)
3 INDEX BY BINARY_INTEGER;
4 l_tab l_tab_type;
5 BEGIN
6 l_tab(1) := 'A';
7 l_tab(2) := 'B';
8 l_tab(3) := 'C';
9 FOR i IN l_tab.FIRST .. l_tab.LAST LOOP
10 dbms_output.put_line(l_tab(i));
11 END LOOP;
12 END;
13 /
A
B
C
PL/SQL procedure successfully completed.
SQL>
SQL> DECLARE
2 TYPE l_tab_type IS TABLE OF VARCHAR2(10)
3 INDEX BY BINARY_INTEGER;
4 l_tab l_tab_type;
5 BEGIN
6 l_tab(1) := 'A';
7 l_tab(3) := 'B';
8 l_tab(4) := 'C';
9 FOR i IN l_tab.FIRST .. l_tab.LAST LOOP
10 dbms_output.put_line(l_tab(i));
11 END LOOP;
12 END;
13 /
A
DECLARE
ERROR at line 1:
ORA-01403: no data found
ORA-06512: at line 10Edited by: JS1 on Apr 11, 2009 8:59 AM
You should also be using the FORALL syntax with INDICES OF. Check out The Docs -
QUERY FOR INSERT INTO SQL TABLE
Hi all,
i want to insert some records into SQL table but not SAP database table. This table is only present in SQL database &
not present in SAP database.
i want to write a program in SAP to update the SQL table(not present in SAP database). is it possible?
if yes, plz give me the query for inserting records into SQL table.
RegardsHello,
working on the same issue:
Try this:
DATA : Begin Of XY Occurs 1000,
id(15) TYPE C,
Name(50) TYPE C,
ArtNr(50) TYPE C,
lieferant TYPE I,
End Of XY.
Fill this internal Table with the SAP-Table
START Connection to your Database
EXEC SQL.
Connect TO 'TEST_FH'
ENDEXEC.
IF SY-SUBRC EQ 0.
EXEC SQL.
Set Connection 'TEST_FH' " <-- this is defines with TCode dbco
ENDEXEC.
IF SY-SUBRC EQ 0.
Else.
" OUT_Msg = '... won't connect'.
Exit.
EndIf. " Else IF SY-SUBRC EQ 0
Else.
" OUT_Msg = 'Error at Set Connection Test_FH'.
Exit.
EndIf. " IF SY-SUBRC EQ 0
ENDE Connection to your Database
START Insert your table XY to an external database
Loop AT XY.
Try.
EXEC SQL.
INSERT INTO stoff
(id, name , artnr, lieferant)
VALUES
( :XY-ID, :XY-Name, :XY-ArtNr, :XY-Lieferant )
ENDEXEC.
COMMIT WORK AND WAIT. " <=== Maybe VERY important
CATCH cx_sy_native_sql_error INTO exc_ref.
error_text = exc_ref->get_text( ).
Concatenate 'Table-INSERT: ' error_text Into error_text.
MESSAGE error_text TYPE 'I'.
ENDTRY.
ENDLoop. " Loop AT XY
END Insert your table XY to an external database
START: Clear Connection
EXEC SQL.
DISCONNECT 'TEST_FH'
ENDEXEC.
END : Clear Connection
Hope it works
Best wishes
Frank -
Error when inserting into a table
Hi,
I am running this insert stmt
SQL> insert into cntct select * from CUSTSRV_ADMN.cntct_bk1;
ERROR at line 1:
ORA-01733: virtual column not allowed here
Below is the table structure.
SQL> desc cntct;
Name Null? Type
CNTCT_KEY NOT NULL NUMBER(10)
CNTCT_NUM NOT NULL CHAR(12)
SRC_SYS_DESC NOT NULL VARCHAR2(5)
ACTVTY_DT NOT NULL DATE
CNTCT_TYPE_DESC NOT NULL VARCHAR2(15)
CNTCT_INIATR_CD NOT NULL CHAR(1)
CNTCT_INIATR_DESC NOT NULL VARCHAR2(10)
CNTCT_INIATR_NAME NOT NULL VARCHAR2(30)
CNTCT_INIATR_PHONE_NUM VARCHAR2
CNTCT_STUS_CD NOT NULL CHAR(1)
CNTCT_STUS_DESC NOT NULL VARCHAR2(10)
CNTCT_AGE_DAYS_CNT NOT NULL NUMBER(4)
CNTCT_ELPSD_TIME_SEC_CNT NOT NULL NUMBER(10)
CNTCT_RCVD_DT NOT NULL DATE
CNTCT_OPEN_DT NOT NULL DATE
CNTCT_RSLTN_DT NOT NULL DATE
CNTCT_NEW_IND NOT NULL CHAR(1)
HIGHST_NMIS_CD NOT NULL NUMBER(1)
INIATNG_AGENT_KEY NOT NULL NUMBER(5)
CLSNG_AGENT_KEY NOT NULL NUMBER(5)
CNTCT_ID NOT NULL VARCHAR2(20)
IMG_NUM NOT NULL VARCHAR2(13)
PRVDR_NPI NOT NULL VARCHAR2(10)
PRVDR_TIN NOT NULL VARCHAR2(9)
CNTCT_OPEN_DTIME NOT NULL DATE
CNTCT_RSLTN_DTIME NOT NULL DATE
Please advise.
Regards,
NarayanNo its another table.
I also tried using columns instead of '*'
SQL> insert into cntct
2 select CNTCT_KEY,
3 CNTCT_NUM,
4 SRC_SYS_DESC,
5 ACTVTY_DT,
6 CNTCT_TYPE_DESC,
7 CNTCT_INIATR_CD,
8 CNTCT_INIATR_DESC,
9 CNTCT_INIATR_NAME,
10 CNTCT_INIATR_PHONE_NUM,
11 CNTCT_STUS_CD,
12 CNTCT_STUS_DESC,
13 CNTCT_AGE_DAYS_CNT,
14 CNTCT_ELPSD_TIME_SEC_CNT,
15 CNTCT_RCVD_DT,
16 CNTCT_OPEN_DT,
17 CNTCT_RSLTN_DT,
18 CNTCT_NEW_IND,
19 HIGHST_NMIS_CD,
20 INIATNG_AGENT_KEY,
21 CLSNG_AGENT_KEY,
22 CNTCT_ID,
23 IMG_NUM,
24 PRVDR_NPI,
25 PRVDR_TIN,
26 CNTCT_OPEN_DTIME,
27 CNTCT_RSLTN_DTIME
28 from CUSTSRV_ADMN.cntct_bk1;
Still have the same error.
insert into cntct
ERROR at line 1:
ORA-01733: virtual column not allowed here
Please advise.
Regards,
Narayan -
JDBC receiver adapter - Error processing request in sax parser
Hello,
I want to INSERT idoc data via JDBC adapter into a MS SQL database. After digging through SAP Help, numerous blogs and forum discussions on SDN and even posting an OSS message I still get the same error:
'Error: TransformException error in xml processor class: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)'
When testing my mapping in the Integration Repository the resulting XML message is:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Employee xmlns:ns0="http://prodrive.nl/xi/HRMasterdata/HRMD_A_2_d_bcommerp">
<STATEMENT>
<T_PD_Employees action="INSERT">
<access>
<KeyTag>00088888</KeyTag>
<PerNo>00088888</PerNo>
</access>
</T_PD_Employees>
</STATEMENT>
</ns0:Employee>
The connection to the database is fine, Sender adapter with a SELECT * works perfect.
Can anyone help me solve this problem? I'm lost.
Best regards,
Roelof Jan BouwknegtHi Bhavesh,
I have tried out the change you suggested. Without success. Message I get back is
- 2006-12-28 10:34:08 CET: Error: TransformException error in xml processor class: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)
structure in testtool:
<?xml version="1.0" encoding="UTF-8"?>
<ns0:Employee xmlns:ns0="http://prodrive.nl/xi/HRMasterdata/HRMD_A_2_d_bcommerp">
<STATEMENT>
<T_PD_Employees action="INSERT">
<ACCESS>
<KEYTAG>00088888</KEYTAG>
<PERNO>00088888</PERNO>
</ACCESS>
</T_PD_Employees>
</STATEMENT>
</ns0:Employee>
Somehow the SAX parser doesn't like the result of my mapping. Maybe there is something wrong with the structure cardinality. Let me describe what I have built:
XSD:
WA_T_PD_Employees - Complex Type
> STATEMENT - Element - Occurence = 1
>> T_PD_Employees - Element - Occurence = 1
>>> STATEMENT - Attribute - Occurence = optional
>>> access - Element - Occurence = 1..Unbounded
Best regards Roelof Jan and thanks for your quick response -
JDBC Receiver adapter configuration for MS SQL
Hi friends,
I have configured receiver jdbc adapter for MS SQL database which are as follows:
jdbc driver : com.microsoft.sqlserver.jdbc.SQLServerDriver
connection: jdbc:sqlserver://USLABWDB01:1433;DatabaseName=Central_Lab_BIDB
In communcation channel i am getting following error:
Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error when attempting to get processing resources: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: DriverManagerException: Cannot establish connection to URL 'jdbc:sqlserver://USLABWDB01:1433;DatabaseName=Central_Lab_BIDB': UnsupportedClassVersionError: com/microsoft/sqlserver/jdbc/SQLServerDriver (Unsupported major.minor version 49.0)
Kindly tell me what is the root cause of the issue.
Renu.Hi Renu,
Try foll. 2 steps:
1) Add the IP address of the server(USLABWDB01) to the host file of your PI server, as you are connecting using Hostname.
2)Try the following connection strings:
jdbc driver : com.microsoft.jdbc.sqlserver.SQLServerDriver
connection: jdbc:microsoft:sqlserver://USLABWDB01:1433;DatabaseName=Central_Lab_BIDB
Here, 'microsoft' word is added in connection string.
Try using this, it should work.
-Tanaya. -
JDBC Receiver adapter error Ingres
Hi all,
i need some help.
I m trying to implement a R/3 IDoc -> XI -> DB Ingres 2.6 communication scenario and i m getting the following error in the communication channel monitor:
"Error when attempting to get processing resources: com.sap.aii.af.service.util.concurrent.ResourcePoolException: Unable to create new pooled resource: DriverManagerException: Cannot establish connection to URL 'jdbc:edbc://
The only file which i install in the com.sap.aii.af.jmsproviderlib is the edbc.jar. Do we need some other file(s) for ingres 2.6?
Thanks and regards StefanosThanks a lot people.
The problem is solved. Finally we do use\install the iijdbc.jar driver with the following
communication channel settings:
JDBC Driver: com.ingres.jdbc.IngresDriver
Connection: jdbc:ingres://192.168.131.7:II7/testdb;ENCODE=GREEK
This solves the problem and we are able to update the ingres Data Base.
Best regards
Stefanos -
Using Bulk operations for INSERT into destination table and delete from src
Hi,
Is there any way to expediate the process of data movement?
I have a source set of tables (with its pk-fk relations) and a destination set of tables.
Currently my code as of now, is pickin up the single record in cursor from the parentmost table, and then moving the data from other respecitve tables. But this is happening one by one... Is there any way I can make this take less time?
If I use bulk insert and collections, i will not be able to use the DELETE in the same block for same source record.
Thanks
Regards
AbhivyaktiAbhivyakti
I'm not 100% sure how your code flows from what you've stated, but generally you should try and avoid cursor FOR LOOPS and possibly BULK COLLECTING.
I always follow the sequence in terms of design:
1. Attempt to use bulk INSERTS, UPDATES and/or DELETES first and foremost. (include MERGE as well!)
2. If one cannot possibly do the above then USE BULK COLLECTIONS using a combination of RETURNING INTO's and
FORALL's.
However, before you follow this method and if you relatively new to Oracle PL/SQL,
share the reason you cannot follow the first method on this forum, and you're bound to find some
help with sticking to method one!
3. If method two is impossible, and there would have to be a seriously good reason for this, then follow the cursor FOR LOOP
method.
You can combine BULK COLLECTS with UPDATES and DELETES, but not with INSERTS
bulk collect into after insert ?
Another simple example of BULK COLLECTING
Re: Reading multiple table type objects returned
P; -
JDBC Receiver Adapter -- Synch Select. ERROR
Hello,
We have implemented the scenario described by Bhavesh Kantilal in blog 3928:
JDBC Receiver Adapter -- Synchronous Select Step by Step
/people/bhavesh.kantilal/blog/2006/07/03/jdbc-receiver-adapter--synchronous-select-150-step-by-step
but modified to our requirements.
An Idoc is coming in, mapped to a sync receiver jdbc as described to collect data from a jdbc table.
Result when connecting the oracle database with the jdbc receiver adapter:
Error processing request in sax parser: Error when executing statement for table/stored proc. 'T_ST_MAINDRIVER' (structure 'STATEMENT'): java.sql.SQLException: ORA-00942: table or view does not exist
Oh, like to complete the information by the payload from the jdbc rec. connect:
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_JDBC_LOOPUP_ID xmlns:ns0="http://www.xxx.org/excel">
- <STATEMENT>
- <TABLENAME ACTION="SELECT">
<TABLE>T_ST_MAINDRIVER</TABLE>
<ACCESS />
- <KEY>
<MAINDRIVER compareOperation="=">Optomechanical</MAINDRIVER>
</KEY>
</TABLENAME>
</STATEMENT>
</ns0:MT_JDBC_LOOPUP_ID>
The table exists on the database. So, what is our mistake? Do you have any ideas?
Best regards
Dirk
Message was edited by:
Dirk Meinhard
Message was edited by:
Dirk MeinhardHi Anil,
I am back on my JDBC problem and I am one step further!
Thank you for this hint. Looks like this is the solution.
So I like to add my next question !
My new error is resulting from my query command.
I have set "=" to find a specific entry as compare operation.
Error when executing statement for table/stored proc. 'IRIS.T_ST_MAINDRIVER' (structure 'STATEMENT'): java.sql.SQLException: FATAL ERROR document format in structure 'TABLENAME': unexpected value '=' for attribute 'compare' found
Looks like this is not ok .
This is my xml of this query:
<ns0:MT_JDBC_LOOPUP_ID xmlns:ns0="http://www.xxx.org/excel">
<STATEMENT>
<TABLENAME ACTION="SELECT">
<TABLE>IRIS.T_ST_MAINDRIVER</TABLE>
<ACCESS/>
<KEY>
<MAINDRIVER compareOperation="=">Optomechanical</MAINDRIVER>
</KEY>
</TABLENAME>
</STATEMENT>
</ns0:MT_JDBC_LOOPUP_ID>
Can you, or anybody else, give the helping idea?
regards
Dirk -
Issue with processing time of JDBC receiver adapter
Hi all,
We are using PI 7.1 EHP1.
We have an issue with JDBC receiver adapter taking too much time to process messages.
We are using XML SQL format message protocol with INSERT_UPDATE as the document format.
Each message can contain multiple records, i.e. 1 single message can result in many updates/inserts.
Currently, time taken to process in 6-12 secs which is quite high considering the messages are not very large in size.
We sent the statements to Oracle DBA to see if anything about the queries being used is causing issues. Awaiting inputs.
In the mean time, wanted to check if there is anything that can be done from PI side that will help us improving the processing time.
Thanks in Advance,
Sailaja.Hi,
i think the main cause is query taking long time to execute in DataBase.
-> increase the read time and response time in the JDBC receiver adapter.
In the advanced mode table section of sender channel and receiver channel configurations, we can set driver properties for each DB connection. Any such property would have to contain prefix 'driver:'(with out quotes).
For Oracle Database JDBC thin driver 10.2.0.3 version, the property oracle.jdbc.ReadTimeout helps to set read timeout while reading from the socket. Also for setting login time out in Oracle, we use oracle.net.CONNECT_TIMEOUT. To set these two properties use as follows: driver:oracle.jdbc.ReadTimeout 1000 driver:oracle.net.CONNECT_TIMEOUT 1000 The TimeOut Driver properties like ReadTimeout and CONNECT_TIMEOUT are in milliseconds.
Refer note 1078420 for more details
please go through this blog i hope it will help you.
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c059d583-a551-2c10-e095-eb5d95e03747
regards,
ganesh
Edited by: ganesh.nijampudi on Oct 25, 2011 12:00 PM -
Fetch data from one table and insert into two tables in desired format
I have similar to the following data in a table and it is not normalized. The groupID is being used to group two records of similar nature.
DECLARE @OldDoc TABLE (oldDocID INT, groupID INT, deptID INT)
INSERT INTO @OldDoc (oldDocID, groupID) VALUES (1, NULL, 111),(2,NULL,111),(3,1,111),(4,NULL,333),(5,1,222),(6,NULL,333),(7,2,222),(8,2,333),(9,NULL,111),(10,3,222),(11,NULL,333),(12,3,444)
I need to process the data from the above table (@OldDoc) and write into two new tables (@NewDoc and @NewDocGroup) as follows.
oldDocID should be stored as newDocID when inserting to @NewDoc table. Only records with groupID NULL and one record (first one) per group should be considered (For example, oldDocID 5 is not considered as 3 and 5 belong to the same groupID 1) for insertion.
DECLARE @NewDoc TABLE (newDocID INT)
INSERT INTO @NewDoc (newDocID) VALUES (1),(2),(3),(4),(6),(7),(9),(10),(11)
All records from @OldDoc should be considered for insertion into @NewDocGroup table. OldDocID is inserted as NewDocID and deptID is as-is. Instead of groupID, the ID of the first record in the
group should be considered as parentNewDocID (For example, 3 is considered as parentNewDocID for newDocID 5 as 3 and 5 belong to the same groupID in @OldDoc table) for the newDocID.
DECLARE @NewDocGroup (newDocID INT, parentNewDocID INT, deptID INT)
INSERT INTO @NewDocGroup (newDocID, parentNewDocID, deptID) VALUES (1,1,111),(2,2,111),(3,3,111),(4,4,333),(5,3,222),(6,6,333),(7,7,222),(8,7,333),(9,9,111),(10,10,222),(11,11,333),(12,10,444)
How do I accomplish the above using SQL ? Thanks for the help.>> I have similar to the following data in a table and it is not normalized. The group_id is being used to group two records [sic] of similar nature. <<
Rows are not records. Tables have to have a key by definition. You do not do math with identifiers, so they should not be numeric. Let's ignore that error for now. In short, you are posting garbage. If you had followed Forum Netiquette, would you have posted
this?
CREATE TABLE Old_Documents
(old_doc_id INTEGER NOT NULL PRIMARY KEY,
group_id INTEGER,
dept_nbr INTEGER NOT NULL
REFERENCES Departments (dept_nbr));
INSERT INTO Old_Documents(old_doc_id, group_id, dept_nbr)
VALUES (1, NULL, 111),
(2, NULL, 111),
(3, 1, 111),
(4, NULL, 333),
(5, 1, 222),
(6, NULL, 333),
(7, 2, 222),
(8, 2, 333),
(9, NULL, 111),
(10, 3, 222),
(11, NULL, 333),
(12, 3, 444);
>> I need to process the data from the above table (Old_Documents) and write into two new tables (New_Documents and New_Documents_Groups) as follows. <<
Just like punch cards and mag tape data processing! Being old and being new are a status, not another kind of entity. But that is how mag tapes work. And you even use the verb "fetch" from tape files. This design flaw is called attribute splitting.
Do you have a Male_Personnel and Female_Personnel table? NO! It is just Personnel!
>> old_doc_id should be stored as new_doc_id when inserting to New_Documents table. Only records [sic] with group_id NULL and one record [sic] (first [sic; no ordering in a table] one) per group should be considered (For example, old_doc_id 5 is not considered
as 3 and 5 belong to the same group_id =1) for insertion. <<
Think about your punch card mindset. Why did you physically materialize that redundant New_Documents table? Let me answer that: this is how you work with punch cards! In SQL we use a VIEW:
CREATE VIEW New_Documents (new_doc_id)
AS
SELECT old_doc_id
FROM Old_Documents;
>> All records [sic] from Old_Documents should be considered for insertion into New_Documents_Groups table. The old_doc_id is inserted as new_doc_id and dept_nbr is as-is. Instead of group_id, the ID [sic: which identifier??] of the first [sic: tables
have no ordering like a deck of punch cards] record [sic] in the group should be considered as parent_new_doc_id (For example, 3 is considered as parent_new_doc_id for new_doc_id 5 as 3 and 5 belong to the same group_id in Old_Documents table) for the new_doc_id.
<<
Why not use 5 as the parent? My guess is that you are trying to form equivalence classes. See:
https://www.simple-talk.com/content/print.aspx?article=2020
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL
Maybe you are looking for
-
Can I mute all audio from Final Cut Pro X?
Can I mute all audio from Final Cut Pro X so that I can listen to music while I do sorting, keywording, favoriting, etc? I'm doing a video where all the camera audio won't be used anyways, so I don't need to hear it in FCPX.. I'd rather just listen t
-
Studio 2 can create/see remote servers but not in remote deployment
In Sun Studio Creator 2, I can create and see my remote servers but when I try to remote deploy my web app from "Deploy to Remote Server", my remote servers do not show up on the list (Only Add Remote Server is there). On my laptop with the same vers
-
Function module modification(z_hr_read_quali_texte)
when i execute the function module the result is a table with 10 lines(example) i donot want these lines having in the exported table LINES of the function module H2Notiz angelegt von daniela Schwaiger (sgd) am 14.07.2005 um 17:45:11 (cet) H2Noti
-
CheckBandwidth callback functions
Hi, I just start with server-side embedded checkBandwidth function. I wonder is there any description of arguments and return values of onBWCheck and onBWDone. Seems like onBWCheck return something, but does it matter what it returns? I wonder why th
-
i recently bought pages for my imac , i now have an ipad and would like to also put it there, but i have no clue how to do it.