Using native database sequences in ODI
Hi,
I am using ODI 11.1.1.7.0 on windows 64 bit machine.
I have written the following queries:
create table sequence_src (EmpName varchar(20), salary int);
create table sequence_tgt( CustId int, CustName varchar(20));
create sequence emp_sequence
minvalue 101
maxvalue 999
start with 101
increment by 1;
insert into sequence_src values('abc',1000);
insert into sequence_src values('sdsd',2000);
insert into sequence_src values('ress',3000);
insert into sequence_src values('zzx',4000);
insert into sequence_src values('dsw',5000);
commit;
So as you see i have created sequence named emp_sequence in my database
When i map the target column i.e EmpID with the following implementation
EMP_SEQUENCE.NEXTVAL
I get an error when the interface runs saying " EMPID" is an invalid identifier on target connection oracle
how to solve this error?
can anyone tell how to use database native sequences in ODI
EDIT: This is complete error log
ODI-1228: Task native_sequence (Integration) fails on the target ORACLE connection all_oracle11g_server.
Caused By: java.sql.SQLSyntaxErrorException: ORA-00904: "EMPID": invalid identifier
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1115)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1488)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3954)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1539)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:163)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:102)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:1)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:50)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:577)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:468)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2128)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:722)
Hi,
SaichandVaranasi
This is error log
insert into ODIWR.I$_SEQUENCE_TGT
CUSTNAME,
IND_UPDATE
select
CUSTNAME,
IND_UPDATE
from (
select
SEQUENCE_SRC.EMPNAME CUSTNAME,
'I' IND_UPDATE
from ODIWR.SEQUENCE_SRC SEQUENCE_SRC
where (1=1)
) S
where NOT EXISTS
( select 1 from ODIWR.SEQUENCE_TGT T
where T.CUSTID = S.CUSTID
and ((T.CUSTNAME = S.CUSTNAME) or (T.CUSTNAME IS NULL and S.CUSTNAME IS NULL))
Similar Messages
-
Problem using secondary database, sequence (and custom tuple binding)
I get an exception when I try to open a Sequence to a database that has a custom tuple binding and a secondary database. I have a guess what the issue is (below), but it boils down to my custom tuple-binding being invoked when opening the sequence. Here is the exception:
java.lang.IndexOutOfBoundsException
at com.sleepycat.bind.tuple.TupleInput.readUnsignedInt(TupleInput.java:4
14)
at com.sleepycat.bind.tuple.TupleInput.readInt(TupleInput.java:233)
at COM.shopsidekick.db.community.Shop_URLTupleBinding.entryToObject(Shop
_URLTupleBinding.java:72)
at com.sleepycat.bind.tuple.TupleBinding.entryToObject(TupleBinding.java
:73)
at COM.tagster.db.community.SecondaryURLKeyCreator.createSecondaryKey(Se
condaryURLKeyCreator.java:38)
at com.sleepycat.je.SecondaryDatabase.updateSecondary(SecondaryDatabase.
java:546)
at com.sleepycat.je.SecondaryTrigger.databaseUpdated(SecondaryTrigger.ja
va:42)
at com.sleepycat.je.Database.notifyTriggers(Database.java:1343)
at com.sleepycat.je.Cursor.putInternal(Cursor.java:770)
at com.sleepycat.je.Cursor.putNoOverwrite(Cursor.java:352)
at com.sleepycat.je.Sequence.<init>(Sequence.java:139)
at com.sleepycat.je.Database.openSequence(Database.java:332)
Here is my code:
// URL ID DB
DatabaseConfig urlDBConfig = new DatabaseConfig();
urlDBConfig.setAllowCreate(true);
urlDBConfig.setReadOnly(false);
urlDBConfig.setTransactional(true);
urlDBConfig.setSortedDuplicates(false); // No sorted duplicates (can't have them with a secondary DB)
mURLDatabase = mDBEnv.openDatabase(txn, "URLDatabase", urlDBConfig);
// Reverse URL lookup DB table
SecondaryConfig secondaryURLDBConfig = new SecondaryConfig();
secondaryURLDBConfig.setAllowCreate(true);
secondaryURLDBConfig.setReadOnly(false);
secondaryURLDBConfig.setTransactional(true);
TupleBinding urlTupleBinding = DataHelper.instance().createURLTupleBinding();
SecondaryURLKeyCreator secondaryURLKeyCreator = new SecondaryURLKeyCreator(urlTupleBinding);
secondaryURLDBConfig.setKeyCreator(secondaryURLKeyCreator);
mReverseLookpupURLDatabase = mDBEnv.openSecondaryDatabase(txn, "SecondaryURLDatabase", mURLDatabase, secondaryURLDBConfig);
// Open the URL ID sequence
SequenceConfig urlIDSequenceConfig = new SequenceConfig();
urlIDSequenceConfig.setAllowCreate(true);
urlIDSequenceConfig.setInitialValue(1);
mURLSequence = mURLDatabase.openSequence(txn, new DatabaseEntry(URLID_SEQUENCE_NAME.getBytes("UTF-8")), urlIDSequenceConfig);
My secondary key creator class looks like this:
public class SecondaryURLKeyCreator implements SecondaryKeyCreator {
// Member variables
private TupleBinding mTupleBinding; // The tuple binding
* Constructor.
public SecondaryURLKeyCreator(TupleBinding iTupleBinding) {
mTupleBinding = iTupleBinding;
* Create the secondary key.
public boolean createSecondaryKey(SecondaryDatabase iSecDB, DatabaseEntry iKeyEntry, DatabaseEntry iDataEntry, DatabaseEntry oResultEntry) {
try {
URLData urlData = (URLData)mTupleBinding.entryToObject(iDataEntry);
String URL = urlData.getURL();
oResultEntry.setData(URL.getBytes("UTF-8"));
catch (IOException willNeverOccur) {
// Success
return(true);
I think I understand what is going on, and I only noticed it now because I added more fields to my custom data (and tuple binding):
com.sleepycat.je.Sequence.java line 139 (version 3.2.44) does this:
status = cursor.putNoOverwrite(key, makeData());
makeData creates a byte array of size MAX_DATA_SIZE (50 bytes) -- which has nothing to do with my custom data.
The trigger causes an call to SecondaryDatable.updateSecondary(...) to the secondary DB.
updateSecondary calls createSecondaryKey in my SecondaryKeyCreator, which calls entityToObject() in my tuple-binding, which calls TupleInput.readString(), etc to match my custom data. Since what is being read goes for more than the byte array of size 50, I get the exception.
I didn't notice before because my custom tuple binding used to read fewer that 50 bytes.
I think the problem is that my tuple binding is being invoked at all at this point -- opening a sequence -- since there is no data on which it can act.Hi,
It looks like you're making a common mistake with sequences which is to store the sequence itself in a database that is also used for application data. The sequence should normally be stored in separate database to prevent configuration conflicts and actual data conflicts between the sequence record and the application records.
I suggest that you create another database whose only purpose is to hold the sequence record. This database will contain only a single record -- the sequence. If you have more than one sequence, storing all sequences in the same database makes sense and is safe.
The database used for storing sequences should not normally have any associated secondary databases and should not be configured for duplicates.
--mark -
BPEL 10.1.2 Integration w/ Oracle E-Business Suite Database Sequences
All,
I have read the previous posts on database sequences, but I am still missing something. I am attempting to insert into a database column using a database sequence. In my toplink_mappings.xml (under Integration content), I make the changes as suggested in previous posts ( I have read most all of them on this subject) to manually insert two lines under the primary key as follows:
<sequence-number-field>AP.AP_INVOICES_INTERFACE.INVOICE_ID</sequence-number-field>
<sequence-number-name>AP.AP_INVOICES_INTERFACE_S</sequence-number-name>
When I then attempt to re-deploy the process without going through the partner link, I get the ORA-00942: table or view does not exist. I am guessing this is related to the two lines above that were inserted manually as instructed below. However, when I attempt to go back through the partner link to validate the changes the two manual lines are wiped out and I then get ORA-01400: cannot insert NULL into "AP"."AP_INVOICES_INTERFACE"."INVOICE_ID"). Furthermore, I have gone into Applications Sources ->TopLink->TopLink Mappings Database Info Sequencing Section. I toggled between "Use Default Sequence Table"/"Use Native Sequencing". I think I need Use Native Sequencing do to my integration with Oracle Apps, but I am not sure (PreAllocation set to 1 per Apps).
Also, I have read the references from previous post to the BPEL Developers guide and reviewed the "Changes Through TopLink Mapping Workbench". However the section on No Primary Key Exception does not address my issue because it does not address automatic sequence generation for primary keys.
Any help with regard to this issue is very much appreciated. I too am trying to perform a BPEL and OEBS 10.5.9/9i database integration proof of concept and would be interested in discussing what I am working on with others in a similar position. Thanks.
DonHi Don,
I have seen this before internally:
"I've selected "Use Native Sequencing" in the Toplink Mappings and used the DB Adapter wizard to regenerate the toplink_mappings.xml, but the BPEL process manager still wants to access a table called SEQUENCE."
The solution is to change your oc4j-ra.xml to set useNativeSequencing="true". Otherwise the adapter will think AP.AP_INVOICES_INTERFACE_S is a database table designed to store the next primary keys rather than a sequence. That may explain the table not found exception.
For next release we will at least ship a sample on how to auto-assign primary keys on insert. We do have a feature request to incorporate this into the wizard to make it more painless.
Also to prevent your additions to toplink_mappings.xml from being overwritten, you can configure sequencing inside the TopLink Mapping Workbench Project inside Jdev.
Go
Application Sources > TopLink > TopLink Mappings.
Then in structure pane click on the ApInvoicesInterface descriptor and check "Use Sequencing" and set the SequenceName to "AP.AP_INVOICES_INTERFACE_S".
Thanks
Steve -
Use of db sequence in a materialized view
Hi,
Will it be possible to use a database sequence in a materialized view?
The materialized view is to return the result set of query that joins multiple tables. One of the columns in the result set - the to-be-created materialized view - is null and requires a sequence.
Will it be possible to include a db sequence in the query?
Example:
create materialized view example_mview
as
select example_sequence.nextval, table1.'*', table2.'*'
from example_table1 table1, example_table2 table2
where table1.id=table2.idWhat is the purpose of such numbering? To number each row?
If so - then use ROWNUM as 1st column.
SQL>with ddd
as
(select 333 COL from dual union all select 5444 COL from dual)
select rownum,COL from ddd;ROWNUM COL
1 333
2 5444 -
Using oracle db sequence for auto generating of PKs for CMP entity beans
Hi,
I have read quite a number of threads about (auto) generation of keys for primary keys for the CMP entity beans.
My requirement is I am migrating an application deployed on Weblogic to oc4j. The application is using cmp entity beans with auto key generation using a sequence in the Oracle db. This is specified in weblogic-cmp-rdbms-jar.xml file like below:
<automatic-key-generation>
<generator-type>Oracle</generator-type>
<generator-name>REPUSER.DEPT_REPORT_SEQ</generator-name>
<key-cache-size>1</key-cache-size>
</automatic-key-generation>
In the ejb-jar.xml, it is specified as:
<prim-key-class>java.lang.Integer</prim-key-class>
<primkey-field>id</primkey-field>
Now, I need to migrate this to oc4j. Can somebody suggest me options and clarify my questions kindly?
1) I have read articles that say that in the ejb-jar.xml, we need to specify <prim-key-class>java.lang.Object</prim-key-class> and this will create a column called 'autoid' in the respective entity table in the Oracle db.
- How can I use this to assign the value to my primary field, say, id?
2) Now, with the latest oc4j, can I use Oracle database sequence as the key generator for the values of the PKs just by specifying in the xml descriptor ejb-jar.xml?
2.a) If yes, is there any article that explains with the code?
2.b) If no, what are the alternatives I have?
I have read many discussions that say that we can create a stateless session bean that can lookup the database sequence using simple JDBC call to return the nextval of the sequence. The SSB should be called in the ejbCreate() of the entity bean.
My related question is, what is recommended for oc4j? What are limitations of the various options for the latest oc4j available?
How should I go about deploying this kind of ejbs in oc4j?
Any help and pointers are welcome. Please help.
Thanks a lot.
VadiHello ,
Instead of exposing a get/set method for each arribute of your bean (corresponding to database table) expose only one object.
For example
public class CustomerBean implements javax.ejb.EntityBean{
private CustomerVO objCustomer;
private String customerName;
private String customerMail;
private String customerType;
public CustomerVO getCustomer(){
return this.objCustomer;
public void setCustomer(CustomerVO objCustomer){
this.objCustomer = objCustomer;
public void ejbStore(){
customerName = objCustomer.getName();
customerMail = objCustomer.getMail();
customerType = objCustomer.getType();
HTH
VJ -
Using Database Sequence in Interface with Union
Hi Gurus,
I have Oracle 11gR2 database as my Source and Target.
When I try to use Database Sequence along with an Interface having set operator like Union , I am getting the following error:
ODI-1227: Task eSIS_Student_U1_Fact (Export) fails on the source ORACLE connection ESISDW.
Caused By: java.sql.SQLSyntaxErrorException: ORA-02287: sequence number not allowed here
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:462)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:405)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:931)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:481)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:205)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:548)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:217)
at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:947)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1283)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1441)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3769)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3823)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1671)
at oracle.odi.query.JDBCTemplate.executeQuery(JDBCTemplate.java:189)
at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:89)
at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:1)
at oracle.odi.runtime.agent.execution.DataMovementTaskExecutionHandler.handleTask(DataMovementTaskExecutionHandler.java:70)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.processTask(SnpSessTaskSql.java:2913)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java:2625)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatAttachedTasks(SnpSessStep.java:558)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java:464)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java:2093)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$2.doAction(StartSessRequestProcessor.java:366)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:216)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.doProcessStartSessTask(StartSessRequestProcessor.java:300)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor.access$0(StartSessRequestProcessor.java:292)
at oracle.odi.runtime.agent.processor.impl.StartSessRequestProcessor$StartSessTask.doExecute(StartSessRequestProcessor.java:855)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:126)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:82)
at java.lang.Thread.run(Thread.java:662)
Is there any work around to use Database Sequence along with the Interface?
Regards,
Sai.Hi Arv,
Thanks for the reply. I tried that also, but still no luck.
Regards,
Sai. -
Why is the "Use Native Sequencing" option disabled ?
I am trying Toplink with SQL Server and I have some identity fields... I see in the documentation that I should select the "Use Native Sequencing" option in the mapping properties(Database Info tab) but it is disabled(I use JDeveloper 10.1.2.1.0). Is there any reason for this ?
Thanks in advance.Native sequencing should be configurable for the SQL Server platform. I have filed a bug to track this.
The easiest workaround is to select a different database platform (i.e. Oracle) and then enable native sequencing. You should then set it back to SQL Server. In my quick test it kept the native sequencing configuration even though it shows as disabled.
Doug -
Using Native SQL in ABAP for DB2 database
Dear Friends,
I have 500K records in ITAB(Internal table) which needs to insert in 'Z' transparent table. Currently it is taking hours of time for insertion and commit.
Does using Native SQL helps in performance or any suggestions? If so please send the code. Our database is DB2.
Your immediate reply is appreciated. Thanks in advance.Hi Rama,
Using array inserts and commit after each Insert, set up your array size as a parameter and try different array sizes.
I would start with 2000 and increment by 1000 or 2000 and see what the optimal array size is.
I would think more commits are desirable, as the array gets bigger it takes longer for the system to prepare in the event of a rollback.
Just remember to commit after each insert. And are you enqueueing the table first?
Hope this helps.
Filler -
How to use Native XA in XE database?
Hi,
I am having problem in using XA datasource in XE. I understand if we are using XE database, jvm is not available. Thus, we have to use Native XA which requires using JDBC Thin Driver.
My JBoss hit below error during initialization.....
=====================================
2006-03-28 16:14:27,645 INFO [org.jboss.system.server.Server] JBoss (MX MicroKernel) [3.2.3 (build: CVSTag=JBoss_3_2_3 date=200311301445)] Started in 1m:18s:482ms
2006-03-28 16:16:05,887 WARN [org.jboss.tm.TransactionImpl] XAException: tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=snz-dcs-001//51, BranchQual=] errorCode=XAER_RMERR
oracle.jdbc.xa.OracleXAException
at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1157)
at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:295)
at org.jboss.resource.adapter.jdbc.xa.XAManagedConnection.start(XAManagedConnection.java:143)
at org.jboss.tm.TransactionImpl.startResource(TransactionImpl.java:1148)
at org.jboss.tm.TransactionImpl.enlistResource(TransactionImpl.java:636)
at org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener.enlist(TxConnectionManager.java:455)
at org.jboss.resource.connectionmanager.TxConnectionManager.managedConnectionReconnected(TxConnectionManager.java:343)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:483)
at
Can anyone help to enlighten?
Or maybe provides me with basic configuration of using XA datasource in XE database so I can check whether my config is correct or not?
Any help will be appreciated!
Thanks before.
JoelHi,
Here's an update regarding my problem with XA transaction using XE.
I don't know exactly how, but it works now.
Here are the steps I did :
===================
1. I decided to try creating JAVA_XA package in XE database. I took the script
from oracle enterprise edition.
This package can't be compiled in XE Production version, but it can be compiled
in XE beta version.
2. After using compiling, the JBoss initialization was still failing.
3. Backup the database (with JAVA_XA) , and upgraded the beta-version to
Production version.
4. Restore the database (with JAVA_XA) into the Production version.
5. it works :))
Hopefully I can get some inputs/comments from the experts here in the forum.
Thanks for those who has responded to my previous posts.
Regards,
Yoel
Good job! A nice extra mile. -
Database Polling - Using Update a Sequence File - Not working
Hi All,
We need to use the Database Adapter Polling feature to poll a table for inserts and updates. In the database configuration page of "After Read" , we have used "Update a Sequencing File".
But the process is not being triggered. Any one has successfully tried this option.
Do we need to do any additional configurations ?
Please respond. Its urgent.
Thanks,
SayamaIf this is your first time working with the Property Loader I recommend the following steps:
- Save the Sequence File and go to Tools-> Import/Export Properties…
- Set the Data Location to be a File (You can change it later if you need to use a Database).
- Enter the file path.
- Select a File Format.
- Go to the Properties Tab and from the Available properties list (tree) select your global variable. The global variable should appear in the selected properties list.
- Click the Export Button.
- If you go back to the Source Destination File and click on View File you will notice that the file you selected was generated and that it has a special format.
You will identify the name of your variable under <File Globals> and the variable value under ‘Variable Value’.
Change the variable value to whatever value you want and save the file.
- Now, if you click the Import Button, the tool will get the value from the source file and set the edit-time copy of the sequence global variable to the value you entered in the file.
- Click the Done button and go and check the value of the sequence global variable. The value should be the value you entered in the file. -
SQL Server and Database Sequence
I am trying to use the Database Adapter to insert rows into a SQL Server table and have followed the directions in the other post on this topic. Those directions are specific to inserting into an Oracle Database.
If I don't insert the
<sequence-number-field></sequence-number-field>
<sequence-number-name></sequence-number-name>
fields I get an error that you can't insert into an Identity column.
When I add both of the fields in the toplink_mappings.xml file (which having the sequence-number-name for a SQL Server database which doesn't have a separate sequence object) I get this error:
[SQLServer]Invalid object name 'SEQUENCE'. Internal Exception: java.sql.SQLException: [oias][SQLServer JDBC Driver][SQLServer]Invalid object name 'SEQUENCE'. Error Code: 208
Stating that Sequence is not a valid object which makes sense.
So when I remove the sequence-number-name element I get an error when I deploy the process stating that "if you have one of the sequence elements you have to have both".
I must be doing something wrong. Any help is greatly appreciated.Hi
In a SQL Server database, you can just use an "identity" column. An identity column is automatically populated and incremented. You don't need to put any mapping in the ODI interface. Just keep it blank.
You cannot use the ODI Sequence, because ODI Sequence will be called only 1 time for all you rows (during the "insert rows" step of the IKM), and you'll have the same number for all your rows. Not exactly what you expect for a surrogate key. Actually, it will only work if you're doing a "row by row" loading.
Otherwise, here's a workaround :
- create an ODI variable that get the max ID of your dimension table (select max(row_id) from table_dim_X)
- in your interface mapping, populate the target column with "VARIABLE + ROWNUM"
ROWNUM gives you the number of the row, in oracle database.
In SQL Server, you can use the function ROW_NUMBER() -
How to use Native SQL statement in JDBC receiver interface
Dear All,
Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
Select Field1 Field2 from TABLE Where Field3 like "%Name'
I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
Hence I need to know:-
1. What message mapping I should use in case if I have to use Native SQL statement.
2.What operation mapping I should use in case if I have to use Native SQL statement.
If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
3 .How do to go about it to do the Java mapping.
Thanks
Ameet>
Ameet Deshpande wrote:
> Dear All,
>
> Can any one please help us in using Native SQL statement in a JDBC receiver channel. The reason why I need to use Native SQL statement instead of standard XML structure is that I need to execute a dynamic SQL query in third party database system lke:-
>
> "
> Select Field1 Field2 from TABLE Where Field3 like "%Name'
> "
> I expect the the response in the form of XML file which I can pick up using synchornous interface as mentioned on help.sap.com:-
>
> http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
> http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
>
> The value for %Name can change dynamically according to the transaction and hence cannot be inluded as a KEY element in standard XLM structure,
>
> Hence I need to know:-
>
> 1. What message mapping I should use in case if I have to use Native SQL statement.
> 2.What operation mapping I should use in case if I have to use Native SQL statement.
> If guess correclty I may have to use Java mapping to do the above activities. Hence I want to know
> 3 .How do to go about it to do the Java mapping.
>
> Thanks
> Ameet
You can use a stored procedure, and call it from jdbc receiver adapter.
I also solve this issue, with a DBLookup in message mapping. You can refer to my blog, and this usefull 3d:
http://simonlesflex.wordpress.com/2010/12/07/pi-oracle-dblookup/
/people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
/people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler -
HR Reporing Payroll using Logical Database PNPCE
Hi ALL
Can any body explain me how can we do HR Payroll reporing using logical database PNPCE.
In the program attibutes as mentioned we need to scee 900 for payroll reporting, but when I use PNPCE I cant see that screen in the Dropdown.
can any body help me with this.
regards
AJcheck this program..
REPORT ZHR_PAYROLL_EX1
MESSAGE-ID ZZ
LINE-SIZE 132
LINE-COUNT 64(2)
NO STANDARD PAGE HEADING .
T A B L E S *
TABLES : PA0001 , "Infotype 0001
PCL1, "HR Cluster 1
PCL2, "HR Cluster 2
T549A, "Payroll Accounting Areas
T549Q. "Payroll Periods
I N C L U D E S *
*--Standard Include for US Payroll
INCLUDE RPC2RUU0. "Cluster RD data definition
INCLUDE RPC2CD00. "Cluster CD Data-Definition
INCLUDE RPC2CA00. "Cluster CA Data-Definition
INCLUDE RPC2RX00. "Cluster RF data definition internat. part
INCLUDE RPPPXD00. "Data definition buffer PCL1/PCL2
INCLUDE RPPPXD10. "Common part buffer PCL1/PCL2
INCLUDE RPPPXM00. "Buffer handling routine
INTERNAL TABLES
*Internal Table to Hold data from PA0001
DATA : BEGIN OF I_0001 OCCURS 0,
PERNR LIKE PA0001-PERNR, "Personnel Number
END OF I_0001.
*Internal Table to Hold data from PA0001
DATA : BEGIN OF I_FINAL OCCURS 0,
PERNR LIKE PA0001-PERNR, "Personnel Number
GAMNT LIKE PC207-BETRG, "Gross Amount
NTAMT LIKE PC207-BETRG, "Net Amount
PAYDT LIKE PC261-PAYDT, "Pay Date
RUNDT LIKE PC261-RUNDT, "Run Date
VORNA LIKE PA0002-VORNA, "First Name
NACHN LIKE PA0002-NACHN, "Last Name
END OF I_FINAL.
*Internal Table to Hold data from PA0002
DATA : BEGIN OF I_0002 OCCURS 0,
PERNR LIKE PA0002-PERNR, "Personnel Number
VORNA LIKE PA0002-VORNA, "First Name
NACHN LIKE PA0002-NACHN, "Last Name
END OF I_0002.
Control record type
TYPES : BEGIN OF T_T569V,
ABKRS LIKE T569V-ABKRS, "Personnel Area
PABRJ LIKE T569V-PABRJ, "Accounting year
PABRP LIKE T569V-PABRP, "Accounting period
STATE LIKE T569V-STATE, "Status of Control Record
ADRUN LIKE T569V-ADRUN, "HR: Special payroll run
END OF T_T569V.
STRUCTURES
DATA : WA_T569V TYPE T_T569V. " Work area for t569v
DATA
DATA : V_PABRJ LIKE T569V-PABRJ, "Accounting year
V_PABRP LIKE T569V-PABRP, "Accounting period
V_BEGDA LIKE SY-DATUM, "Begin Date
V_ENDDA LIKE SY-DATUM, "End Date
V_FPPER(6) TYPE C, "For Period
V_SEQNR LIKE PC261-SEQNR. "Sequence Number
SELECTION SCREEN
Selectio Screen Block for Employee Selection.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_PERNR FOR PA0001-PERNR, "Pernr
S_DATE FOR SY-DATUM. "Date
SELECTION-SCREEN END OF BLOCK B1.
START-OF-SELECTION
START-OF-SELECTION.
*Get Data from pa0001
PERFORM GET_DATA_FROM_0001.
*Get Data from pa0001
PERFORM GET_DATA_FROM_0002.
*Get CHAD Details
PERFORM GET_PAYDATA.
END-OF-SELECTION
END-OF-SELECTION.
IF NOT I_FINAL[] IS INITIAL.
*Print the Final Report.
PERFORM PRINT_REPORT.
ENDIF.
T O P O F P A G E
TOP-OF-PAGE.
Display Header
PERFORM DISPLAY_HEADER.
S U B - R O U T I N E S
*& Form get_data_from_0001
Get Data from 0001
FORM GET_DATA_FROM_0001.
SELECT PERNR "Personnel Number
FROM PA0001
INTO TABLE I_0001
WHERE PERNR IN S_PERNR AND
ENDDA >= S_DATE-LOW AND
BEGDA <= S_DATE-HIGH .
IF SY-SUBRC = 0.
SORT I_0001 BY PERNR.
ENDIF.
ENDFORM. " get_data_from_0001
*& Form get_data_from_0002
Get Data from 0002
FORM GET_DATA_FROM_0002.
SELECT PERNR "Personnel Number
VORNA
NACHN
FROM PA0002
INTO TABLE I_0002
WHERE PERNR IN S_PERNR AND
ENDDA >= S_DATE-LOW AND
BEGDA <= S_DATE-HIGH .
IF SY-SUBRC = 0.
SORT I_0002 BY PERNR.
ENDIF.
ENDFORM. " get_data_from_0002
*& Form populate_chad_coinage_table
text
FORM GET_PAYDATA.
LOOP AT I_0001.
READ TABLE I_0002 WITH KEY PERNR = I_0001-PERNR BINARY SEARCH.
IF SY-SUBRC = 0.
I_FINAL-VORNA = I_0002-VORNA.
I_FINAL-NACHN = I_0002-NACHN.
ENDIF.
Read Result Directory for Payroll Results for a Employee.
PERFORM CU_READ_RGDIR.
Get Sequence Number & Associated Payroll Results.
PERFORM GET_PAYROLL_RESULTS.
ENDLOOP.
ENDFORM. " get_paydata
*& Form cu_read_rgdir
Reag rgdir to get the results with conty grouping 'TD'
FORM CU_READ_RGDIR.
DATA : V_MOLGA LIKE T500L-MOLGA ."Country Grouping
*Call function module to get Results
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
PERSNR = I_0001-PERNR
IMPORTING
MOLGA = V_MOLGA
TABLES
IN_RGDIR = RGDIR
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2.
SORT RGDIR BY SEQNR.
ENDFORM. " cu_read_rgdir
*& Form get_payroll_results
Get Sequence number
FORM GET_PAYROLL_RESULTS.
LOOP AT RGDIR WHERE SRTZA = 'A' AND
VOID IS INITIAL AND
REVERSAL IS INITIAL AND
OUTOFSEQ IS INITIAL AND
PAYDT IN S_DATE.
V_SEQNR = RGDIR-SEQNR.
*-- Macro Call for Germany
RP-INIT-BUFFER.
RX-KEY-PERNR = I_0001-PERNR.
RX-KEY-SEQNO = V_SEQNR.
RP-IMP-C2-RU.
LOOP AT RT WHERE LGART = '/559'.
I_FINAL-PERNR = I_0001-PERNR.
I_FINAL-GAMNT = RT-BETRG.
I_FINAL-PAYDT = RGDIR-PAYDT.
I_FINAL-RUNDT = RGDIR-RUNDT.
APPEND I_FINAL.
CLEAR I_FINAL.
ENDLOOP.
ENDLOOP.
ENDFORM. "get_payroll_results
*& Form display_header
Display Header
FORM DISPLAY_HEADER .
FORMAT COLOR 1.
ULINE.
WRITE:/1 SY-VLINE,
(15) 'Empl Number',
SY-VLINE,
(20) 'First Name',
SY-VLINE,
(20) 'Last Name',
SY-VLINE,
(15) 'Pay Date',
SY-VLINE,
(15) 'Run Date',
SY-VLINE,
(25) 'Gross Amount',
132 SY-VLINE.
ULINE.
FORMAT COLOR OFF.
ENDFORM. " display_header
*& Form print_report
Display Report
FORM PRINT_REPORT .
LOOP AT I_FINAL.
WRITE:/1 SY-VLINE,
(15) I_FINAL-PERNR,
SY-VLINE,
(20) I_FINAL-VORNA,
SY-VLINE,
(20) I_FINAL-NACHN,
SY-VLINE,
(15) I_FINAL-PAYDT,
SY-VLINE,
(15) I_FINAL-RUNDT,
SY-VLINE,
(25) I_FINAL-GAMNT,
132 SY-VLINE.
ULINE.
ENDLOOP.
SKIP 2.
WRITE:/1 'Period Begin Date:',(25) V_BEGDA.
WRITE:/1 'Period End Date:',(25) V_ENDDA.
ENDFORM. " print_report -
Hi all,
How do i use Native SQL String in the Reciver JDBC Adapter.
Do i need to change the message format could u suggest me some blogs on the same.
Also please can anyone let me knw if i can use this for stored procedure.hi aditya,
there shud be no format as such. for sql xml format there are specific structure. but for native sql there shudnt be any specific structure.
as pointed in sap documentaion:
Instead of an XML document format, a text is expected that represents any valid SQL statement.
When inserting a line into a table the corresponding document looks as follows:
INSERT INTO tableName (column-name1, column-name2, column-name3) VALUES(column-value1, column-value2, column-value3)
so jus make sure that u give a valid sql statement becoz if will be passed as it is to the database and try ur scenario.
regards,
latika. -
Primary Key from Database Sequence
Hi,
I have a form that has a master block(single_record) and a child block(multi-record). I am using Database Sequence for primary key. And I am not using any toolbar, instead using the default from FORMS. I want to keep this primary key field invisible and non-navigable.
Which triggers should I write the sequence.nextval code in the form ??
Thanks!!
ShaluThanks so much!! I'll try that!!
I hope I won't get this error: it doesn't let me come out from the field unless i enter a value, because being primary it is mandatory, though i want the field to be non-navigable and i'll turn the display to false.
Thanks Again!!
Shalu
Maybe you are looking for
-
Oracle Reports - Change Email Attachment Name
Hello, I'm sending salary receipts in PDF via email using Report Server 10g. It's working but i want to change the PDF name, in order to appear the number of employee in the name (something like Receipt_00001.PDF) I used to accomplished that in other
-
Error 403 signing in to iCloud
Info on error 403 while trying to set up iCloud
-
Moving application windows between two monitors in Mountain Lion
I have a Macbook Pro that sits on my desk below an external monitor that is hooked into the laptop. I use the Displays setting to arrange my external monitor on top of my laptop monitor. Unitl I install Mountain Lion, I used to be able to move wind
-
Can't configure EPM modules after ODI 11.1.1.6 install
So recently ran the EPM 11.1.2.1 install on my windows server r2 x86. I have configured foundation. Then i proceeded to install ODI 11.1.1.6. ODI installed successfully and runs. Although now I can't configure essbase with shared services. Anyone kno
-
Invalid Signature (how to report a (potential) bug ) ?
Hi, we have a PDF document signed via our IE browser (CAPICOM). When we open the document Acrobat (Professional) - version 8/9 - tells us the document has been modified since the signature was placed - which is of course not true. When we open this i