Multiple Schema select Query problem
Hi everyone,
when I tried to execute a select query as following,
select A.field1, B.field2 from S1.table1 A, S2.table2 B
in a session bean, it gives an exception as follows
" An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction"
Can anyone pls help me in this regard.
Thanking you
D. Suresh Kumar
This is the query i thought of executing
SELECT * FROM SCH2.AP_TRANSACTION_EPS A, TRANSACTION_TYPES B WHERE C_FUND_CODE = '" + fundCode + "'AND D_TRADE_DATE = to_date('" + date + "','yyyy-mm-dd') AND A.C_TRANS_CODE = B.C_TRANS_CODE " + " AND B.C_TRANS_TYPE = '" + transType + "' ";
where "fundCode", "date","transType" are java variables.
The error message is
[8/1/03 12:38:49:688 IST] 491a6a5 TransactionIm E WTRN0062E: An illegal attempt to use multiple resources that have only one-phase capability has occurred within a global transaction.
[8/1/03 12:38:49:750 IST] 491a6a5 ConnectO A CONM6014I: Received exception (IllegalStateException) in method (enlist). Issuing new exception (IllegalTransactionStateException). The original exception's stack trace was: java.lang.IllegalStateException
Thanking you
Similar Messages
-
Multiple schemas in query builder
Hi,
I have seen variations of this question returning a couple of times in the forum, but no answer has come forward so far. So let's try again...
In APEX 4.1 (maybe also in earlier versions) there is a drop-down at the top-right of the query-builder tool to select a different schema.
The problem is, that it only shows the "parsing" schema. So the user the workspace is associated with.
I have taken all of the following steps, that i would expect to make the other schemas show up:
- associate my second scheme, SCHEMA_2, to the workspace SPACE_1
- grant the "parsing" schema, SCHEMA_1, select access to all objects in SCHEMA_2
And I have tested the following things:
- in "SQL Commands" run a query that selects objects from SCHEMA_2, using "select * from SCHEMA_2.TEST_TABLE;". This works
- in query builder, select the "SQL" option and insert the same query and click "run". Results in "Please enter a valid query to see results"
- create an application with a "SQL report" page, and insert the same query. Results in "Query cannot be parsed, please check the syntax of your query. (ORA-00942: table or view does not exist)"
My toughts on this issue:
- A different user is used in query builder and the application builder?
- the "SQL commands" uses the "parsing" schema, as expected
So, what's wrong?Is using more then one schema in the query builder such an uncommon requirement?
Or did this message pass by unnoticed? -
Select query problem in JDBC sender adapter
Hello Experts,
We have a problem with PI sender adapter that PI has started to miss records in database some database records are missing and we are using the below selet query :
SELECT * FROM [database name].[dbo].[Material_Movement] WHERE [Process_Order_Number] = (Select TOP 1 [Process_Order_Number] FROM [database name].[dbo].[Material_Movement] WHERE ([PI_Read_Date] IS NULL AND [Movement_Type] = (SELECT TOP 1 [Movement_Type] FROM [database name].[dbo].[Material_Movement] WHERE [Transaction_Code] = 'xyz' AND [PI_Read_Date] IS NULL ORDER BY Created_Date ASC))) AND [Transaction_Code] = 'xyz' AND [Movement_Type] = (SELECT TOP 1 [Movement_Type] FROM [database name].[dbo].[Material_Movement] WHERE [Transaction_Code] = 'xyz' AND [PI_Read_Date] IS NULL ORDER BY Created_Date ASC) AND [PI_Read_Date] IS NULL ORDER BY [Transaction_ID] ASC
I am weak in select query could you please check and suggest how the query can be modified to avoid this issue .
Thanks,
SomenathHi ,
After looking into These Query .. I found ...
Your Query Will run such Kind of scenario ..
1.) Movement Type will be fetched from from below Query
SELECT TOP 1 Movement_Type
FROM database name.dbo.Material_Movement
WHERE Transaction_Code = 'xyz'
AND PI_Read_Date IS NULL
ORDER BY Created_Date ASC
2.) on the basis of abovr fetched moment code . your Query will fetch 1 Process Order number
Select TOP 1 Process_Order_Number
FROM database name.dbo.Material_Movement
WHERE ( PI_Read_Date IS NULL
AND Movement_Type = Moment Type will be same as 1.
3.)
After Getting 1 and 2 . Query will fetch Data from table " dbo.Material_Movement "
On the basis of ..
Movement_Type = value from 1.
Process_order_type = value from 2.
Transaction_Code = 'xyz'
ORDER BY Transaction_ID ASC
So check Missed record Fullfill this Condition or not ....................
If not ... You will get why they are not picked by your given Query ...........
Hope it helps ..
regards
Prabhat Sharma. -
Multiple value selection lists - Problem filtering
I'm builing a news application with publisher, and one of the fields is a multiple value selection list. We're filtering news stories to different pages based on the values. Problem is, I can't get the right content items to display. I did it no problem with a single selection box. The code I'm using is:
<pcs:foreach expr="folderByPath(folder, '../../Articles')" var="articles">
<pcs:foreach expr="articles" var="art">
<pcs:if expr="art.testkeyword == 'choice2'">
</pcs:value>"><pcs:value expr="art.headline"></pcs:value></a><br />
</pcs:if>
</pcs:foreach>
</pcs:foreach>
So if 'choice2' is in a single select list, no problem. If it's part of a multiple select, I get nothing. I'm thinking I'm missing something really easy, like logic operators. But I couldn't find anything of help in the documentationHi,
Make use of contains function.
Syntax : contains(string1,string2) this returns true if string 1 has string 2
Usage
<pcs:if expr="contains(test,'A')">
</pcs:if>
** 'test' is the name of the multi select box
Edited by bharatkarthik at 06/22/2007 4:10 PM -
Hi Experts,
I am having a select query in which I am using a variable in the where condition but it is giving error. Please suggest how to use variable in the select query.
The query I am using is a s below.
select * from zexc_rec into table it_ZEXC_REC
where
LIFNR in S_LIFNR and
DOCNO in S_DOCNO and
DOCTYP in doc_typ and
DATE1 in S_DATE1 and
MATNR in S_MATNR.
Here doc_typ is a variable.
Thanks.Rahul,
use RANGES type variable instead of variable . It acts as a select-options variable. Thn use this variable in SELECT query with IN.
Eg :
RANGES r_t510 FOR t510-lgart.
r_t510-low = '1600'.
APPEND r_t510.
r_t510-low = '3190'.
APPEND r_t510.
Note : can be use SIGN, OPTIONS properties too in RANGES type.
More deatils go through on HELP of RANGES
Rgds,
Ranjith -
hi friends,
i've a view called "risk_efforts" with fields user_id,user_name,wknd_dt,week_day,prod_efforts,unprod_efforts.
Name Type
ROW_ID NUMBER
USER_ID VARCHAR2(14)
USER_NAME VARCHAR2(50)
WKND_DT VARCHAR2(8)
WEEK_DAY VARCHAR2(250)
PROD_EFFORTS NUMBER
UNPROD_EFFORTS NUMBER
data is like this:
when there is some data in prod_efforts, unprod_efforts will be null
when there is some data in unprod_efforts, prod_efforts will be null
for example:
USER_ID USER_NAME WKND_DT WEEK_DAY PROD_EFFORTS UNPROD_EFFORTS
G666999 GTest 20100403 TUE null 3
G666999 GTest 20100403 TUE 14 null
now i want to combine these 2 rows into 1 row i.e o/p should be like this
USER_ID USER_NAME WKND_DT WEEK_DAY PROD_EFFORTS UNPROD_EFFORTS
G666999 GTest 20100403 TUE 14 3
i've tried all combinations but couldn't get the query. Please help me with the exact SQL select query.
thanks,
GirishWelcome to the forum.
First read this:
Urgency in online postings
Secondly, it's always helpful to provide the following:
1. Oracle version (SELECT * FROM V$VERSION)
2. Sample data in the form of CREATE / INSERT statements.
3. Expected output
4. Explanation of expected output (A.K.A. "business logic")
5. Use \ tags for #2 and #3. See FAQ (Link on top right side) for details.
You have provided #3 and #4. However with no usable form of sample data forum members will often not respond as quickly as they could if you provided #2.
I'm just wagering a guess here but what about this:SELECT ROW_ID
, USER_ID
, WKND_DT
, WEEK_DAY
, MAX(PROD_EFFORTS) AS PROD_EFFORTS
, MAX(UNPROD_EFFORTS) AS UNPROD_EFFORTS
FROM RISK_EFFORTS
GROUP BY ROW_ID
, USER_ID
, WKND_DT
, WEEK_DAY -
SELECT query - problem with SORT
Hi,
Same select query behaves different way on development and quality server
on Development it returns unsorted and Quality returns sorted
it can be resolved by SORT but why does it behave differently
Do you know what is setting in database
thanksFrom F1 on SELECT:
Orders the records in a SELECT statement. Without the ORDER-BY clause, the order
in which the selected lines are supplied is undefined. This means that two similar SELECT
statements may produce lines in a different order.
Rob -
This report will take delivery document number and delivery date from user and fetches details from delivery table and fetches
corresponding sales order details and billing details and displays sales order details with ALV list.
<< Please only post the relevant portions of your code >>
i just want to know that is this way of fetching the data into internal table okay ?are there any better ways of fetching the data into the internal table ? why is it looping in work area of lips, why not in likp?
(plz dont use field-symbols or oo abap or macros) I WANT TO USE PLAIN AND SIMPLE ABAP STATEMENTS LIKE ABOVE..
By using "vbeln type lips-vbeln" are we refering to the field or data element? plz suggest.
P.S. [my approach was to inner join likp and lips into itab(my internal table).
select data from kna1, vbak,vbap,vbrp into respective internal tables like it_kna1,it_vbak etc.
then using individual loops into the tables, i would use read table to insert data into itab(my final internal table) plz suggest which method wud be more efficient? ]
Edited by: Rob Burbank on Jun 8, 2009 11:54 AMok i am posting the select queries once again.
i want to know why are we looping in t_lips and why not t_likp? bcoz tlikp is the header table, if we loop thru it and then read the rest tables then what will be the problem? plz clarify with examples._
[my idea was to loop at t_likp then read t_lips.append the lips data into t_order(main internal table).then do read table on t_kna1,t_vbap etc indexing t_order. so plz suggest whether my approach was write or wrong?if wrong why?plz site any other ways of doing this query.
types: begin of ty_vbap,
vbeln type vbap-vbeln,
posnr type vbap-posnr, .....
does the declaration statement in types refer to tables or data elements? what is the difference if we declare it like:
types: begin of ty_vbap,
vbeln type vbeln,
posnr type posnr, .....
select-options:
s_deldoc FOR likp-vbeln, " Delivery
s_dldate FOR likp-lfdat. " Delivery Date
Get delivery document number,delivery date,customer number from
delivery header table
SELECT vbeln " Delivery
lfdat " Delivery Date
kunnr " Customer Number 1
FROM likp
INTO TABLE t_likp
WHERE vbeln IN s_deldoc
AND lfdat IN s_dldate.
IF sy-subrc EQ 0.
Get Customer name for customer numbers from Customer master table
SELECT kunnr " Customer Number 1
name1 " Name 1
FROM kna1
INTO TABLE t_kna1
FOR ALL ENTRIES IN t_likp
WHERE kunnr EQ t_likp-kunnr.
IF sy-subrc EQ 0.
Get delivery item number,sales document number,sales item number,
delivery quantity from delivery item table
SELECT vbeln " Delivery
posnr " Delivery Item
vgbel " Document number of
" reference document
vgpos " Item number of reference item
lfimg " Actual quantity delivered
vrkme " Sales unit
FROM lips
INTO TABLE t_lips
FOR ALL ENTRIES IN t_likp
WHERE vbeln EQ t_likp-vbeln.
IF sy-subrc EQ 0.
Get sales document number,item number,material,material description,
ordered quantity from sales item table
SELECT vbeln " Sales Document
posnr " Sales Document Item
matnr " Material Number
arktx " Short text for sales order
" item
kwmeng " Cumulative Order Quantity
vrkme " Sales unit
FROM vbap
INTO TABLE t_vbap
FOR ALL ENTRIES IN t_lips
WHERE vbeln EQ t_lips-vgbel
AND posnr EQ t_lips-vgpos.
IF sy-subrc EQ 0.
Get sales document number ,created date,purchase order number from
sales header table
SELECT vbeln " Sales Document
erdat " Date on Which Record Was" Created
aufnr " Order Number
FROM vbak
INTO TABLE t_vbak
FOR ALL ENTRIES IN t_lips
WHERE vbeln EQ t_lips-vgbel.
IF sy-subrc EQ 0.* Get billing document number,billing item,reference delivery document
number,delivery item number,billing item from billing item table
SELECT vbeln " Billing Document
posnr " Billing item
vgbel " Document number of the
" reference document
vgpos " Item number of the" reference" item
fklmg " Billing quantity in" stockkeeping unit
vrkme " Sales unit
FROM vbrp
INTO TABLE t_vbrp
FOR ALL ENTRIES IN t_lips
WHERE vgbel EQ t_lips-vbeln
AND vgpos EQ t_lips-posnr.
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ELSE.
Display message if records are not found for entered values
MESSAGE S000.
EXIT.
ENDIF. " IF SY-SUBRC EQ 0
Looping Delivery item internal table to assign values to order
internal table
LOOP AT t_lips INTO fs_lips.
Get delivery date and customer number for delivery document number
from delivery header internal table
READ TABLE t_likp WITH KEY vbeln = fs_lips-vbeln
INTO fs_likp.
Get customer name for customer number from customer master internal
table
IF sy-subrc EQ 0.
READ TABLE t_kna1 WITH KEY kunnr = fs_likp-kunnr
INTO fs_kna1.
Get sales document number,item number,ordered quantity for delivery
document number,item number from sales item internal table
IF sy-subrc EQ 0.
READ TABLE t_vbap WITH KEY vbeln = fs_lips-vgbel
posnr = fs_lips-vgpos INTO fs_vbap.
Get goods issue date and purchase order number for sales document
number from sales header internal table
IF sy-subrc EQ 0.
READ TABLE t_vbak WITH KEY vbeln = fs_vbap-vbeln INTO fs_vbak.
IF sy-subrc EQ 0.
Get billing document number,billing item,billing quantity for delivery
document number,delivery item number from billing item internal table
READ TABLE t_vbrp WITH KEY vgbel = fs_lips-vbeln
vgpos = fs_lips-posnr INTO fs_vbrp.
Assign sales,delivery,billing fields into respective fields of sales
order internal table
IF sy-subrc EQ 0.
fs_order-vbeln = fs_vbap-vbeln.
fs_order-posnr = fs_vbap-posnr.
fs_order-erdat = fs_vbak-erdat.
fs_order-kunnr = fs_likp-kunnr.
fs_order-name1 = fs_kna1-name1.
fs_order-aufnr = fs_vbak-aufnr.
fs_order-matnr = fs_vbap-matnr.
fs_order-arktx = fs_vbap-arktx.
fs_order-kwmeng = fs_vbap-kwmeng.
fs_order-vrkme = fs_vbap-vrkme.
fs_order-vbeln1 = fs_lips-vbeln.
fs_order-posnr1 = fs_lips-posnr.
fs_order-lfimg = fs_lips-lfimg.
fs_order-vrkme1 = fs_lips-vrkme.
fs_order-vbeln2 = fs_vbrp-vbeln.
fs_order-posnr2 = fs_vbrp-posnr.
fs_order-fklmg = fs_vbrp-fklmg.
fs_order-vrkme2 = fs_vbrp-vrkme.
APPEND fs_order TO t_order.
CLEAR fs_order.
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDLOOP. " LOOP AT T_LIPS INTO FS_LIPS -
hi all,
hope all r doing fine?
anyway i have a query which is mentioned below:-
select field1,.....fieldn
from <dbtable1>
into corresponding fields of table itab
where <condition>.
select field1,...fieldn
from <dbtable2>
appending corresponding fields of table itab
where <condition>.
the above two select stmts retrieve same set of fields from two different database tables into same internal table itab..
now my question is ...........is any other way to change 2nd select statement without using appending correspondin fields
but the functionality should remain the same as it is after changing..................
bcos appending corresponding is causing performance problem in data retrieval.
thanx alot in advance.
for sure points will be given for all the helpful answers
JackHi,
You can use like that:
select field1,.....fieldn
from <dbtable1>
into corresponding fields of table itab1
where <condition>.
select field1,...fieldn
from <dbtable2>
appending corresponding fields of table itab2
where <condition>.
now u use:
loop at itab2 into w_itab2.
read table itab1 into w_itab1 with key w_itab1-<primary field> = w_itab2-<Primary field>.
if sy-subrc = 0.
append w_final into i_final.
else continue.
endif.
endloop.
*i_final table having all data ( i.e itab2 & itab1 data) -
Select Query problem....too urgent
Hi all!
I am running oracle 8i.
I have a table named taxsuamry. I want to arrange the data by exepenses in desc order and after sorting, i want to select first 50 records.
I supplied the follwoing query:
select expenses from taxsuamry
where rownum<51
order by expenses desc;
but it selects 50 records first and then sorts them...i want sorting first and then top 50 rerods from sorted data.
Can anybody help me plzhello,riaz
If it is optimization kind of problem for your sorting first ...then u can go for following way...
select /*+ index(empid) */ empid from emp where rownum <51 order by empid desc
.........where empid is attribute where u have index on it....
null -
Select Query Problem-need help
hi,
Help me out from this problem.
Actually i have a table and the data in it as follows:
Department Name Job Name
Accounts Sr. Accountant
Accounts Jr. Accountant
Accounts Cleark
But i dont want the repeated Department Name.. and i want the same output as follows.
Department Name Job Name
Accounts Sr. Accountant
Jr. Accountant
Cleark
Without using sql reports and Sql Plus additional commands.
The same output should come from a sql query only.
Thanks in Advance
Md Anwer AliI shouldn't try to code before I have had at least three cups of coffee. The actual answer is:
select decode(department,lag(department) over (order by department),null,department)
, job
from departments
order by department.
I ran this:
select decode(job,lag(job) over (order by job),null,job)
, ename
from emp
order by job
and got this result:
SQL> /
DECODE(JO ENAME
ANALYST SCOTT
FORD
CLERK SMITH
ADAMS
MILLER
JAMES
MANAGER JONES
CLARK
BLAKE
PRESIDENT KING
SALESMAN ALLEN
MARTIN
TURNER
WARD
14 rows selected. -
hi all.....
i want to setct some data from table vbrp ,vbrk and vbfa .
on selection screen i have vbrk-vbeln and vbfa-erdat i hav written one code for tht but thts not working can nybdy plz help me in this..
parameter : p_vbeln type vbrk-vbeln ,
p_erdat type vbfa-erdat .
*--start of selection events
start-of-selection.
*--SELECTING THE DATA FROM DATABASE INTO INTERNAL TABLE
SELECT v1~vbeln AS vbeln
v1~kunag AS kunag
v1~vkorg AS vkorg
v1~netwr AS netwr
v2~ntgew AS ntgew
v2~matnr AS matnr
v3~erdat AS erdat
INTO CORRESPONDING fields of table it_data1
FROM vbrk AS v1
INNER JOIN vbrp AS v2
ON v1vbeln = v2vbeln
INNER JOIN vbfa AS v3
ON v1vbeln = v3vbeln
WHERE v1~vbeln eq p_vbeln .
loop at it_data1 into wa_data where erdat ne p_erdat.
delete it_data1 from wa_data.
endloop.
end-of-selection.
thanks in advance.....How have you defined your itab ?
You query looks perfectly ok , even if you use vbeln or vbelv it wont matter , it depends on the requirement.
So have you defined your itab correctly ?
for example :
data : begin of itab occurs 0,
vbeln like vbrk-vbeln,
kunag like vbrk-kunag,
netwr like vbrk-netwr,
ntgew like vbrp-ntgew,
matnr like vbrp-matnr,
erdat like vbfa-erdat,
end of itab.
regards,
Advait -
Hi All,
i_dfkkko-xblnr
IF NOT i_dfkkko[] IS INITIAL .
SELECT opbel
belnr
FROM erchc
INTO TABLE i_erchc1
FOR ALL ENTRIES IN i_dfkkko
WHERE opbel EQ i_dfkkko-xblnr.
ENDIF.
I am using the above select query.problem is when i put the value
of i_dfkkko-xblnr by going to the table erchc i am getting the record.But this qury is not resulting any value.
i have checked in debug mode copied the value of xblnr of i_dfkkko
and went to erchc table and passed to opbel of erchc i got the reords.
can anybody pls help..
Rgds,
SaiHi,
The database would be having the value with leading zeroes.
Use FM "CONVERSION_EXIT_ALPHA_INPUT" to conver the values & then pass to select query.
_dfkkko-xblnr
IF NOT i_dfkkko[] IS INITIAL .
loop at i_dfkkko.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
VALUE(INPUT) = i_dfkkko-xblnr
IMPORITNG
VALUE(OUTPUT) = i_dfkkko-xblnr.
modify i_dfkkko.
endloop.
SELECT opbel
belnr
FROM erchc
INTO TABLE i_erchc1
FOR ALL ENTRIES IN i_dfkkko
WHERE opbel EQ i_dfkkko-xblnr.
ENDIF. -
Select query for 6 different tables with vbeln as same selction criteria
Hi,
I have a query..
I am using 6 differnet tables with vbeln being the same primary key on the basis of which i have to match the data.
I have assign vbeln with different name but in the select query it gives me the error that vbeln2 is not the correct field.
Can anyone please suggest how can i use the different field name and read the data from the table.hi,
Use alias name for fields / tables in select query, problem will solve
Regards,
Praveen Savanth.N -
Mind bender select query condition
I posted a thread called very interesting select query problem. Because I am new I did not set the question as unanswered. The question is :
I have selected some material documents from bkpf into i_bkpf. then by looping on it I broke down the AWKEY into mblnr and mjahr and modified the same internal table. Then I created a data base view YMCSKS joining MKPF and MSEG.
I want to write a select query which does not select mblnr and mjahr from YMCSKS which are already there in i_bkpf
sort of like this
select.......
from VIEW (YMCSKS)
where MBLNR <> i_bkpf-mblnrManas
PK is correct. You've had the same question rejected twice yesterday - do you read your email? You've really not provided enough information, and so the problem looks very much like you are wanting other people to do your work. This is no "mind bender". If you can't do it, then you need to be very clear about what you've already tried - newbies are welcome here, but evidence of effort is expected.
Rudeness is not tolerated, so please keep the conversation civil.
If you would like to give more information about what you've tried, and where you are struggling, then I shall leave the thread open. I'm inviting you to restate your question.
mâtt
Maybe you are looking for
-
Windows 8.1 driver for P1505
Hi, On your printer support download page, I found an update for my driver but the installation stalls to 1/3 after less than 10 seconds. I tried to install a least three times to no avail. My portable pc is only a year old and powerful but now runni
-
Hi, I've created a PL/SQL process source (on load - before header) which counts the records of a table. If the number of records is 1 or less the values of the table are to be inserted in the text fields of my HTML form. If there is more than one rec
-
hi, i need help regarding calling OWB from Oracle Forms. i have a transformation routine written in java, which i'd be calling through forms and then switch to OWB. is there a way i can do that? Regards, Mehwish
-
SB Live 24bit external problems with windows 7 beta driver
Hi, I have a problem with my soundcard with the windows 7 beta driver. An unwanted sound come out when I'm doing something like chatting with Yahoo Messenger or buffering Youtube. I don't know what makes it like that, can you guys help me out, please
-
A SOLUTION for those who want to organise their TV SHOWS properly!
Hi folks; I posted this in "Using iTunes for Windows" as well. Finally found a simple, and yes, EASY way to get your self-burned TV shows (from your DVD collection) into iTunes WITH the proper info(ie: season, show, title, description, network, etc..