Subquery in ODI
Hello,
i need an information ...
situation:
i need the NVL ( ..., ....) function.
in the developer it is no problem to test the subquery, but in ODI
i think, it's al little bit more complicated.
NVL( <value from my table>, <subquery> )
at the moment i've written the subquery "by hand"... i've written the complett SQL-Query into to NVL after the comma.
i think that this is not common.
can someone help me?
i'm not sure, should i use an user-function or an variable ? :-/
i'm pretty unsure..
best regards
Michael
Hi Michael
You can do this using the lookup component in ODI 11g. If you add your lookup table or temporary interface as the lookup table and set the 'SQL expression in the select clause' for the lookup, you can define your target expression to be NVL(EMP.SAL, BONUS.SAL) and ODI will generate the select statement for the lookup as a scalar subquery inline replacing the BONUS.SAL part of the expression.
Cheers
David
Similar Messages
-
I Have the following interface in oracle data integrator
http://i44.tinypic.com/2mrsmxt.png
# it execute successfully before inserting the following expression
In the mapping I insert the following SQL expression to get the average when the quantity is 0
AVG(
CASE WHEN TEST.QUN = 0 THEN
(SELECT TEST.QUN FROM TEST
WHERE TEST1.PRUDU=TEST.PRUDU
AND TEST1.FLOW=TEST.UNIT
AND TEST1.UNIT=TEST.UNIT
AND to_char(TEST.DATEDDD,'MON')= to_char(TEST1.DATEDDD,'MON')
AND TEST1.DATEDDD !=TEST.DATEDDD
GROUP BY TEST.QUN
ELSE TEST.QUN
END)
when I check this expression in ODI ..
# the sql expression is correct for this RDMS
when I executed the interface i get this error
Caused By: java.sql.SQLSyntaxErrorException: ORA-00937: not a single-group group function
any idea ?I changed the code a little ..
CASE WHEN TEST.QUN = 0 THEN
(SELECT AVG(TEST.QUN) FROM TEST
WHERE TEST1.PRUDU=TEST.PRUDU
AND TEST1.FLOW=TEST.FLOW
AND TEST1.UNIT=TEST.UNIT
AND to_char(TEST.DATEDDD,'MON')= to_char(TEST1.DATEDDD,'MON')
AND to_char(TEST.DATEDDD,'YYYY')!= to_char(TEST1.DATEDDD,'YYYY')
ELSE TEST.QUN
END
And I get this error ..
ORA-01427: single-row subquery returns more than one row tips.
The TEST Table from the source and TEST1 is a lookup table because I couldn't do the alais in ODI
In sql developer I did the following code that will do the same thing and work successfully ..
update test B
set B.qun=
(SELECT AVG(TEST.QUN) FROM TEST
WHERE TEST.FLOW=B.UNIT
AND TEST.UNIT=B.UNIT
AND TEST.PRUDU=b.prudu
AND TEST.FLOW=b.flow
AND to_char(TEST.DATEDDD,'MON')= to_char(B.DATEDDD,'MON')
AND to_char(TEST.DATEDDD,'YYYY')!= to_char(B.DATEDDD,'YYYY')
where B.qun=0;
any help ?
thanksssss
naif .. -
Help : How to use list of values in Variable in ODI
Dear All,
I have a multiple values in table, and I would to use these values a a parameter in ODI to retrieve rows based on these values. As I know that we can use single value in variable in ODI.
Any one can Help me please?Can't you use a join between the tables ?
ODI mostly take advantage of native technologies.
i.e If my source technology is oracle then i will create a join between the table i.e. MAINTABLE.column = LOVTABLE.COLUMN and also put a filter on LOVTABLE to take required values.
OR you can write a subquery in the Filter i.e. MAINTABLE.COLUMN in ( Select LOVVALUES from LOVTABLE where LOVTABLE.ATTRIBUTE = 'BUSINESS_UNIT') -
How can I move the ODI Work Repository from one server to another server?
How can I move the ODI Work Repository from one server to another server?
Hi,
If you would like to move your source models, target models and project contents from Work repository 1 to another work repository.
I.e. Dev. server to Prod Server.
1. Firstly, replicate the master repository connections i.e. with same naming conventions manually
2. Go to Dev. Server work repository -> File Tab -> Click on Export work repository (save it in a folder)
3. After exporting, you can view the xml files in the folders.
4. Now, Open the Prod. server and make sure you already replicated mas. rep. details.
5. Now, right click on model and import source model in synonym mode insert_update (select source model from the folder where your xml file located)
6. Similarily, import again target then Project.
Now, check. It should work.
Thank you. -
Assigning a Jython variable value to an ODI variable
I have to implement database cursor functionality in ODI.
For storing the returned values from database, I am using a Jython list.
The next functionality that I have to implement is as follows:
(i) For each value in the Jython list, I have to pass that value as a variable to an interface and then execute the interface
(ii) Return back to the Jython list to get the next value in it
(iii) Execute the interface for the new value from Jython list
(iv) Have to execute the interface for as many values as in the list and stop when list is over.Hi,
Thanks for your replies.
I tried your method of using source as a query in procedure and using ODI startScen in the Target of the same procedure. But the scenario runs only once, and then stops even though the Source query returns 4 rows.
Do we have to write Source and Target in separate steps of the procedure?
Does ODI store the many records returned into some internal variables?
I need to implement a cursor functionality so what is the best approach?
Can i pass array variable value to some odi variables and do a loop?
I used a workaround....it works but dont know if that's a good way of doing things:
I retrieved all the different values that I need in a string by appending the values(this was done using Java loop).
In my next step in the procedure I call a scenario(package which has some variables and my interface), which passes this long variable from Java as <@...@>
Then in the package I use an iteration variable which is used to find out the SubString position so that I can extract the correct string to use for my Interface in the next step of the Package.
It is working fine as of now.....but things could be made simpler if I could call the scenario in the Java loop, then I wouldn't need the iteration variable etc. -
Error encountered while assigning a value to a variable in ODI.
we are getting the below error while trying to assign the o/p of the below query to a variable in ODI.THis error is encountered when the Table1 is empty....
select b.res from (select (select CEIL((select count(1) from Table1)/2) - #SMARTS.loop_variable from dual) result from dual) a, (select CEIL((select count(1) from cst_dsa.m_pb_cable_data)/2) res from dual) b where a.result >= 0
java.lang.Exception: Error: No value to affect to this variable for DefDate:2012-05-22 13:57:07.0
DefN:null
DefV:null
IndStore:H
ITxtDefT:null
ITxtVar:null
SessNo:800100
VarDatatype:N
VarName:SMARTS.total_loop_count_cable
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.execStdOrders(SnpSessTaskSqlV.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTaskTrt(SnpSessTaskSqlV.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlV.treatTask(SnpSessTaskSqlV.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.g.y(g.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source)
can somebody pls let me know ,how to handle this exception..This error means that there is no value to assign to your variable, because specified query doesn't return result row. You should rewrite your query to guarantee that it would return row in any case.
For example, select nvl(min(b.res), -1) from (select (select CEIL((select count(1) from Table1)/2) - #SMARTS.loop_variable from dual) result from dual) a, (select CEIL((select count(1) from cst_dsa.m_pb_cable_data)/2) res from dual) b where a.result >= 0 group by a,b
Edited by: apiminov on 15.06.2012 8:18
Edited by: apiminov on 15.06.2012 8:19 -
ERROR WHILE RUNNING ODI SCENARIO FROM BAM ALERT
We are using oracle data integrator 11g and have created an ODI Scenario and able to run the scenario from ODI studio client.
We have done the configuration for BAM-ODI integration as mentioned in http://docs.oracle.com/cd/E21764_01/integration.1111/e10224/bam_odi.htm#BABEJIGD
We have started ODI Agent, soa and bam servers. Created a BAM alert -> select action - Run ODI Scenario -> selected the same scenario.
Alert ran at scheduled time but failed with following error:
java.io.IOException : truncated data integrator frame received
Error Message (if any)
[2012-08-06T11:24:21.046+05:30] [bam_server1] [WARNING] []
[oracle.bam.eventengine] [tid: bam-pool-Action-thread-1] [userId:
OracleSystemUser] [ecid:
3576f9092ef9497a:-743c430a:138fa7450c3:-8000-00000000000000a8,1:23453] [APP:
oracle-bam#11.1.1] EventEngine: Error occured while running a ODI Scenario.
[2012-08-06T11:24:21.250+05:30] [bam_server1] [ERROR] []
[oracle.bam.eventengine] [tid: bam-pool-Action-thread-1] [userId:
OracleSystemUser] [ecid:
3576f9092ef9497a:-743c430a:138fa7450c3:-8000-00000000000000a8,1:23453] [APP:
oracle-bam#11.1.1] EventEngine: Action exception: EEInstEv2 EEInstAct1 Rule
Id: 2 exception: java.io.IOException: truncated Data Integrator Frame
received
[2012-08-06T11:24:21.250+05:30] [bam_server1] [WARNING] []
[oracle.bam.eventengine] [tid: bam-pool-Action-thread-1] [userId:
OracleSystemUser] [ecid:
3576f9092ef9497a:-743c430a:138fa7450c3:-8000-00000000000000a8,1:23453] [APP:
oracle-bam#11.1.1] EventEngine: Exception stack trace: [[
at
oracle.bam.eventengine.engine.event.action.RunScenario.invokeScenario(RunScena
rio.java:145)
at
oracle.bam.eventengine.engine.event.action.ActionProcessor.runScenario(ActionP
rocessor.java:891)
at
oracle.bam.eventengine.engine.event.action.ActionProcessor.actionHandler(Actio
nProcessor.java:337)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.j
ava:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.bam.system.Delegate$Sink.invoke(Delegate.java:80)
at oracle.bam.system.Delegate.dynamicInvoke(Delegate.java:186)
at
oracle.bam.common.threading.threadpool.ThreadPoolController$PoolQueueItem.proc
essWorkRequest(ThreadPoolController.java:155)
at
oracle.bam.common.threading.threadpool.ThreadPoolController$PoolQueueItem.run(
ThreadPoolController.java:128)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java
:886)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908
at java.lang.Thread.run(Thread.java:619)
Any help on this is highly appreciated...
Thanks
Rajdip MukherjeeHi,
Forgot to include the ODI classes RunScenario.invokeScenario() is invoking odi scenario using odi sdk api. Please see the below stack trace :-
java.io.IOException: truncated Data Integrator Frame received
at
oracle.odi.sdk.invocation.internal.AgentNetworkCmd.readCmd(AgentNetworkCmd.java:303)
at
oracle.odi.sdk.invocation.OdiInvocation.invokeCommand(OdiInvocation.java:176)
at
oracle.bam.eventengine.engine.event.action.RunScenario.invokeScenario(RunScenario.java:140)
at
oracle.bam.eventengine.engine.event.action.ActionProcessor.runScenario(ActionProcessor.java:891)
at
oracle.bam.eventengine.engine.event.action.ActionProcessor.actionHandler(ActionProcessor.java:337)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Thanks
Rajdip Mukherjee -
Error while executing a package in ODI
Hi,
I am new to Oracle technology and when i am trying to execute one package through Oracle Data Integrator i am getting the below error. Even when i am trying to execute the procedure 'GENERATE_NAT_KEY' i am getting the error
ODI-1228: Task Generate Natural Key (Procedure) fails on the target ORACLE connection ORACLE_OII.
Caused By: java.sql.SQLSyntaxErrorException: ORA-00904: : invalid identifier
ORA-06512: at "OII_ST.GENERATE_NAT_KEY", line 65
ORA-06512: at line 2
I am not able to figure out the issue. Can any one help me in this regards.Hi;
You have to login https://support.oracle.com/CSP/ui/flash.html and you have to CSI account.
This site is oracle site for tech. documents for can rise SR etc.. for more details please check Re: Installing Oracle Database 10.2.0.4
you need to customer support identifier which is called CSI for can login metalink(https://support.oracle.com/CSP/ui/flash.html)
If you dont have metalink account there is no way to see that doc.
Pretty simple process:
1) You purchase a perpetual or term license from Oracle;
2) At the beginning of the period, during the valid term you purchase
Support for the period (1 year);
3) Oracle sends you the CSI.
Easy to do at http://store.oracle.com armed with a credit card.
Regard
Helios -
Unable to install odi on windows 7 64 bit
I am trying to install odi after installing the RCU on a compatible db.
The odi i downloaded from is http://www.oracle.com/technetwork/middleware/data-integrator/downloads/index.html
the setup starts in command line initially and passes monitor and min CPU requirements and then shows please wait for some time and then finally quits without showing any error etc,
Please adviseok now while using it on launcihing the installer wizard if i use system as username and role as normal it let me go ahead but when i chose odi schema and do next it fails with following error:
2013-01-16 15:11:36.610 NOTIFICATION rcu: oracle.sysman.assistants.common.dbutil.jdbc.JDBCEngine::connect: Connecting to database: user:system, role:Normal, connectString:(description=(address=(host=slc03lod.us.oracle.com)(protocol=tcp)(port=1522))(connect_data=(service_name=SLC03LOD)(server=dedicated)))
2013-01-16 15:11:48.233 NOTIFICATION rcu: oracle.sysman.assistants.common.task.ProgressPanel::progressToNextTask: waiting for delegate to be visible
2013-01-16 15:11:48.244 NOTIFICATION rcu: oracle.sysman.assistants.common.task.ProgressPanel::progressToNextTask: waiting for delegate to be visible
2013-01-16 15:11:48.266 NOTIFICATION rcu: oracle.sysman.assistants.rcu.backend.task.ActualTask::run: Executing Task: Master and Work Repository
2013-01-16 15:11:48.266 NOTIFICATION rcu: oracle.sysman.assistants.rcu.backend.validation.PrereqEvaluator::executePrereqTask: Prereq taskId = ODI
2013-01-16 15:11:48.266 NOTIFICATION rcu: oracle.sysman.assistants.rcu.backend.validation.PrereqEvaluator::executePrereqTask: Starting component prereq check
2013-01-16 15:11:48.287 ERROR rcu: oracle.sysman.assistants.rcu.backend.task.PrereqTask::execute: Prereq Evaluation Failed
oracle.sysman.assistants.rcu.backend.validation.PrereqException: RCU-6083:Failed - Check prerequisites requirement for selected component:ODI
Please refer to RCU log at D:\softwares\office\rcuHome\rcu\log\logdir.2013-01-16_14-17\rcu.log for details.
at oracle.sysman.assistants.rcu.backend.validation.PrereqEvaluator.executePrereqTask(PrereqEvaluator.java:658)
at oracle.sysman.assistants.rcu.backend.task.PrereqTask.execute(PrereqTask.java:68)
at oracle.sysman.assistants.rcu.backend.task.ActualTask.run(TaskRunner.java:306)
at java.lang.Thread.run(Thread.java:662)
2013-01-16 15:11:48.288 ERROR rcu: oracle.sysman.assistants.rcu.backend.task.ActualTask::run: RCU Operation Failed
oracle.sysman.assistants.common.task.TaskExecutionException: RCU-6083:Failed - Check prerequisites requirement for selected component:ODI
Please refer to RCU log at D:\softwares\office\rcuHome\rcu\log\logdir.2013-01-16_14-17\rcu.log for details.
User should have sysdba privileges
at oracle.sysman.assistants.rcu.backend.task.PrereqTask.execute(PrereqTask.java:76)
at oracle.sysman.assistants.rcu.backend.task.ActualTask.run(TaskRunner.java:306)
at java.lang.Thread.run(Thread.java:662)
If i try to connect system with role sysdba then it says invalid username/pwd however i am able to connect the system as sysdba from sqlplus -
Can we preview data after RKM in SAP in ODI 11g
can we able to right click and view data in models after reverse engineering in SAP in ODI 11g ??
Edited by: Drona on Mar 16, 2012 1:06 PMNo we cannot preview the data as SAP connection is made using Jco adapter.
We can only preview the data for data servers which are connected using jdbc. -
Can't view the sheets when using subquery in discoverer desktop
Hi All,
I have created 5 subqueries sheets and I need the data from sheet1, sheet3, sheet5. But in the main sheet when I choose the subquery sheets, its showing only 3 sheets(i.e., sheet1, sheet2, sheet4). I don't want the data from sheet2 and sheet4 but I want from sheet1,3,5. I can't view the sheet3,5.
Please advice.
Thanks,
KamalI use Image Converter for iPad to convert my Sony RAW file.
Not sure if it'll work for Canon. -
ODI not able to detect primary/foreign keys from XML- user lacks privilege or object not found
Hi Guys,
Im trying to load an xml file with two entities address and employee as below. The topology reverse engineering everything works fine. Im even able to view the xml data in ODI, but when i try to load the data from these two entities joining by the schema primary keys and foreign keys which odi created on reverse engineering process for xml, im getting the below error. Im able to load data from one entity, error only occurs when i use the join odi creates internally to identify the xml components employee and address
XML File:
<?xml version="1.0" encoding="UTF-8" ?>
<EMP>
<Empsch>
<Employee>
<EmployeeID>12345</EmployeeID>
<Initials>t</Initials>
<LastName>john</LastName>
<FirstName>doe</FirstName>
</Employee>
<Address>
<WorkPhone>12345</WorkPhone>
<WorkAddress>Test 234</WorkAddress>
</Address>
</Empsch>
</EMP>
Topology: jdbc:snps:xml?f=C:/Temp/RR/Empsch.xml&s=Empsch&re=EMP&dod=true&nobu=false
Error Message:
-5501 : 42501 : java.sql.SQLException: user lacks privilege or object not found: EMPSCH.EMPSCHPK
java.sql.SQLException: user lacks privilege or object not found: EMPSCH.EMPSCHPK
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.JDBCPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
at com.sunopsis.jdbc.driver.xml.SnpsXmlConnection.prepareStatement(SnpsXmlConnection.java:1232)
at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at oracle.odi.core.datasource.dwgobject.support.OnConnectOnDisconnectDataSourceAdapter$OnDisconnectCommandExecutionHandler.invoke(OnConnectOnDisconnectDataSourceAdapter.java:200)
at $Proxy2.prepareStatement(Unknown Source)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.doInitializeStatement(SQLCommand.java:83)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:117)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.getStatement(SQLCommand.java:111)
at oracle.odi.runtime.agent.execution.sql.SQLDataProvider.readData(SQLDataProvider.java:81)
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: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:662)
Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: EMPSCH.EMPSCHPK
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.ExpressionColumn.checkColumnsResolved(Unknown Source)
at org.hsqldb.QueryExpression.resolve(Unknown Source)
at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source)
at org.hsqldb.ParserCommand.compilePart(Unknown Source)
at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
at org.hsqldb.Session.compileStatement(Unknown Source)
at org.hsqldb.StatementManager.compile(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 27 more
Please advice
Thanks
RevanthThats obvious from the xml file contents you have given here. In this xml file You have four complex type. Two of them are employee and address. However the employee doesnot have any relation with address as you have not added the relationship. Thats why its failing. Its not the fault of ODI.
Also I would suggest not to use auto generated dtd by ODI as you might face problem in future. For example the address type of XML has 8 attributes and 4 of them are not mandatory. That means each of your xml file may have attributes between 4 to 8. This is where ODI auto generated DTD fails.
XML Schema complexType Element
Thanks
Bhabani -
Unable to configure ODBC data source through odi
Hi,
Let me explain the architecture first.
We have three machines
1. OpenVMS machine on which connx server is running for RMS files, say SRC
2. Windows machine on which ODI Data Studio 11.1.1, Say WRKSTN, This has connx client installed
3. Target is HP-UX on which SYBASE is running, say TRGT. On target we have installed connx client and ODI Stand alone agent and agnt01 is the name of the agent that is running
My Requirement is,
I need to pull the data from SRC and load it into TRGT using the ODI agent agnt01, through ODBC data connectivity.
If i configure DSN on my WRKSTN they the agnt01 is unable to identify. If i configure a DSN on HP-UX machine then i am not able to specify that in ODI Sun odbc: Jdbc bridge driver.
Kindly help me as to how i can resolve this
Thanks,
Rajesh HConfiguring DSN on windows workstation would not help as the agent is not running on that machine. The DSN has to be configured on the machine where the agent is running on which you want to execute the flow. What error are you getting on trying to specify the DSN name on HPUX in the data server jdbc url?
-
TWO ERRO ORA-01427: single-row subquery returns more than one row
Hi,
I have a procedure which contains a cursor. If i run the select statement in the cursor separetly, it returns only value and works fine. But the same select statement in the cursor of a procedure throws me the error as below:
TWO ERRO ORA-01427: single-row subquery returns more than one row
Not sure what going on...any help appreciated.
Below is the select statement:
SELECT DISTINCT PSE.PARENT_POSITION_ID,
(SELECT DISTINCT PPD1.SEGMENT2
FROM PER_POSITION_DEFINITIONS PPD1,
HR_ALL_POSITIONS_F HAPF2,
PER_POS_STRUCTURE_ELEMENTS PSE2
WHERE TRUNC(SYSDATE) BETWEEN
HAPF2.EFFECTIVE_START_DATE AND
HAPF2.EFFECTIVE_END_DATE
AND PPD1.POSITION_DEFINITION_ID =
HAPF2.POSITION_DEFINITION_ID
AND
HAPF2.POSITION_ID = PSE2.PARENT_POSITION_ID
AND PSE2.PARENT_POSITION_ID =
PSE.PARENT_POSITION_ID
AND ROWNUM = 1) SEGMENT2,
(SELECT DISTINCT PAPF1.FIRST_NAME || ' ' ||
PAPF1.LAST_NAME CHIEF_NAME
FROM PER_ALL_PEOPLE_F PAPF1,
PER_ALL_ASSIGNMENTS_F PAAF1
WHERE TRUNC(SYSDATE) BETWEEN
PAPF1.EFFECTIVE_START_DATE AND
PAPF1.EFFECTIVE_END_DATE
AND TRUNC(SYSDATE) BETWEEN
PAAF1.EFFECTIVE_START_DATE AND
PAAF1.EFFECTIVE_END_DATE
AND PAAF1.POSITION_ID = PSE.PARENT_POSITION_ID
AND PAPF1.PERSON_ID = PAAF1.PERSON_ID
AND ROWNUM = 1) CHIEF_NAME
FROM PER_POS_STRUCTURE_ELEMENTS PSE,
HR_ALL_POSITIONS_F HAPF,
PER_POSITION_DEFINITIONS PPD
WHERE PSE.SUBORDINATE_POSITION_ID = 52744
AND TRUNC(SYSDATE) BETWEEN HAPF.EFFECTIVE_START_DATE AND
HAPF.EFFECTIVE_END_DATE
AND HAPF.POSITION_ID = PSE.SUBORDINATE_POSITION_ID
AND HAPF.POSITION_DEFINITION_ID = PPD.POSITION_DEFINITION_ID;
Thanks
PK
Edited by: user539616 on Jun 30, 2009 6:30 PMHi,
The cursor has a different parameter? Maybe the query is not exactly the same. Could you check this?
This is your query (formatted):
SELECT DISTINCT PSE.PARENT_POSITION_ID,
(SELECT DISTINCT PPD1.SEGMENT2
FROM PER_POSITION_DEFINITIONS PPD1,
HR_ALL_POSITIONS_F HAPF2,
PER_POS_STRUCTURE_ELEMENTS PSE2
WHERE TRUNC(SYSDATE) BETWEEN HAPF2.EFFECTIVE_START_DATE AND
HAPF2.EFFECTIVE_END_DATE
AND PPD1.POSITION_DEFINITION_ID = HAPF2.POSITION_DEFINITION_ID
AND HAPF2.POSITION_ID = PSE2.PARENT_POSITION_ID
AND PSE2.PARENT_POSITION_ID = PSE.PARENT_POSITION_ID
AND ROWNUM = 1) SEGMENT2,
(SELECT DISTINCT PAPF1.FIRST_NAME || ' ' || PAPF1.LAST_NAME CHIEF_NAME
FROM PER_ALL_PEOPLE_F PAPF1,
PER_ALL_ASSIGNMENTS_F PAAF1
WHERE TRUNC(SYSDATE) BETWEEN PAPF1.EFFECTIVE_START_DATE AND
PAPF1.EFFECTIVE_END_DATE
AND TRUNC(SYSDATE) BETWEEN PAAF1.EFFECTIVE_START_DATE AND
PAAF1.EFFECTIVE_END_DATE
AND PAAF1.POSITION_ID = PSE.PARENT_POSITION_ID
AND PAPF1.PERSON_ID = PAAF1.PERSON_ID
AND ROWNUM = 1) CHIEF_NAME
FROM PER_POS_STRUCTURE_ELEMENTS PSE,
HR_ALL_POSITIONS_F HAPF,
PER_POSITION_DEFINITIONS PPD
WHERE PSE.SUBORDINATE_POSITION_ID = 52744
AND TRUNC(SYSDATE) BETWEEN HAPF.EFFECTIVE_START_DATE AND HAPF.EFFECTIVE_END_DATE
AND HAPF.POSITION_ID = PSE.SUBORDINATE_POSITION_ID
AND HAPF.POSITION_DEFINITION_ID = PPD.POSITION_DEFINITION_ID;Tips: To put formatted code you must use {noformat}{noformat} tags, start tag and end tag are the same,you don't need to put '/' in the close tag.
Regards, -
Subquery in IF statement in trigger, without using foreign keys
Hello,
I'm investigating ways of writing a subquery in an IF statement, which is placed inside a trigger.
I wanna write smth like IF (:new.jazz not in (select goldies from T where ... )) etc. I don't know whether the fact that the IF is in a trigger adds some additional restrictions. (Does it?)
So far I found the solution described here: SubQuery Comparison in If Statement which I find a bit tacky, I could have the 'cooleststarinthegalaxy' instead of 1 and seems you need to do extra light, but still extra lifting.
I also read about the possibility of using MERGE, which I'm currently researching.
Is there any other way?
Thanks
Edited by: BluShadow on 14-Nov-2012 13:37
fixed link
Edite by me: the question is how (if possible) to do this without a foreign key.
Edited by: questioningq12 on Nov 14, 2012 6:11 AM
Edited by: questioningq12 on Nov 14, 2012 6:13 AMHi,
questioningq12 wrote:
Say I have tables A(namea varchar(10)), B(nameb varchar(10)), and B contains tuples ('1stname','2ndname').
I wrote a trigger before insertion, for each row, on table A. For a tuple t to be inserted, it should check whether t.namea is in the set of values nameb from B.
E.g., INSERT INTO A VALUES('1stname') should work. But INSERT INTO A VALUES ('3rdname') should fail. You can use a foreign key constraint for that.
If the tables already exist, and b.nameb is declared as UNIQUE (or PRIMARY KEY), then you can say:
ALTER TABLE a
ADD CONSTRAINT a_namea_fk
FOREIGN KEY (namea)
REFERENCES b (nameb)
;If you had a situation where you really needed to query a table in PL/SQL, and you weren't sure if the query would find anything, you could put the query in its own BEGIN ... EXCEPTION block, and test for NO_DATA_FOUND.
If you're just checking to see if a row exists or not, you can always write a query that is guaranteed to return exactly 1 row, like this:
BEGIN
SELECT COUNT (*)
INTO x
FROM b
WHERE nameb = :NEW.namea
AND ROWNUM = 1;
IF x = 0
THEN
... -- print msgs, raise exceptions etc
END IF;
END;Edited by: Frank Kulash on Nov 14, 2012 9:22 AM
Added example
Maybe you are looking for
-
I have three macs on a wireless network. all machines have a relatively large amount of data (over 120GB). i have a 2TB USB drive lying around that i wanted to use for time machine backups. what i want to do is to "seed" the backup of the other machi
-
Ultiroute says "Check user authorization"
My Ultiroute has suddenly started giving me a "Please check your User Authorization" error message when I try to route a board. Ultiboard runs fine, the internal rip-up router seems to be OK, but Ultiroute won't run any more. I can't find any way of
-
Hi guys there is a big problem with Nokia Xpress it's displaying improper image. First download the file here http://file4share.mywap.lt/files/833200/3nd_001.jpg (left to right) >Nokia Xpress >UC Browser >Opera Mini as you can see the picture 1 compa
-
Formatted Search formula result in 4 digit
Hi Experts, Can we round the the result of formatted search formula into 4 digits ? See sample below SELECT (325.000000 * 0.750000 ) / 100 from inv1 Current result 2.44* * Result should be
-
Hi Experts Can you please specify what is Adhoc Work /Adhoc Development in terms of SAP BW Thanks