Problem with insertChildXML, deleteXML, XMLTable query
Hello
I'm working on a
Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production
With partitioning, Real Application Clusters, Automatic Storage Management, OLAP,.
Options of Data Mining and Real Application Testing
POWER SUPPLY 11.2.0.3.10
I have a table with an XMLTYPE field.
In this area, I insert an object XMLType in this way:
INSERT INTO t_schedule_alert (id_schedule_alert, id_schedule, i_type_alarm_schedule, id_lang_type_alarm_schedule, id_user, x_alert_type, i_status_schedule_alert, id_lang_status_schedule_alert)
VALUES (sq_id_schedule_alert.nextval, in_id_schedule, in_i_type_alarm_schedule, 1, id_user_, xml_, ln_schedule_st_alert_waiting, 1)
RETURN id_schedule_alert INTO id_;
Where xml_ = XMLtype ("< alert_types >" | ") alert_type_config_ | ("< / alert_types > ') and alert_type_config_ = ' < type > email < / Type > < sms type > < / type > ';
The insert does not work correctly, infact him select query:
SELECT MAX (s.id_schedule_alert) id_schedule_alert, | |
s.id_schedule, | |
s.id_user, | |
s.i_type_alarm_schedule, | |
Max (s.type_alarm_schedule) type_alarm_schedule, | |
Max (s.i_status_schedule_alert) i_status_schedule_alert, | |
Max (s.status_schedule_alert) status_schedule_alert, | |
Max (s.id_data) id_data, | |
Max (decode (his. TYPE_, 'sms', 1, 0)) sms,. | |
Email Max (decode (his. TYPE_, 'email', 1, 0)) | |
Max (decode (his. TYPE_, 'event', 1, 0)) event. | |
Expedition Max (decode (his. TYPE_, 'dispatch', 1, 0)) | |
OF v_schedule_alert s. | |
XMLTable ('/ alert_types/type ') | |
in passing s.x_alert_type | |
path of varchar2 (10) columns type_ "text()". | |
) its | |
WHERE s.id_schedule =: b1 | |
AND s.id_user =: b2 | |
GROUP OF s.id_schedule, s.id_user, s.i_type_alarm_schedule; |
Works very well in showing me the email = 1 sms = 1, event = 0, = 0 shipping.
Then, using this function to manipulate the XML:
-function update_alert
FUNCTION update_alert)
in_id_schedule in NUMBERS
in_i_type_alarm_schedule in NUMBERS
iv_alert_type IN VARCHAR2,
in_id_user in NUMBERS
in_action in NUMBERS
) RETURN NUMBER
IS
id_user_ NUMBER;
alm_exists_ NUMBER;
XMLType count_;
BEGIN
IF in_id_schedule IS NULL or in_i_type_alarm_schedule IS NULL or iv_alert_type IS NULL or in_action IS NULL THEN
raise_application_error (pk_global.not_enough_param, pk_global.not_enough_param_text);
END IF;
id_user_: = in_id_user;
IF id_user_ IS NULL THEN
id_user_: = pk_security.who_am_i;
END IF;
-update of configuration for the user, add / or remove
IF in_action = 0 THEN
-delete if this is the last of them
XMLQuery ('SELECT count($XML/alert_types/descendant::*)'
by passing s.x_alert_type as 'XML' content of return)
IN count_
OF s t_schedule_alert
WHERE s.id_schedule = in_id_schedule
AND s.id_user = id_user_
and i_type_alarm_schedule = in_i_type_alarm_schedule;
IF to_number (count_.getstringval ()) > 1 THEN
UPDATE t_schedule_alert
SET x_alert_type = deleteXML)
x_alert_type,
' / alert_types/type [text () =' ' | iv_alert_type |] » »] »
)
WHERE id_schedule = in_id_schedule
AND i_type_alarm_schedule = in_i_type_alarm_schedule
AND id_user = id_user_;
END IF;
ELSIF in_action = 1 THEN
-Add if not exists
SELECT CASE WHEN XMLExists (' $ alert_types/XML/type [text () = $ALM]' from x_alert_type as 'XML', iv_alert_type as 'ALM')
THEN 1 ELSE 0 END exists_
IN alm_exists_
OF v_schedule_alert
WHERE id_schedule = in_id_schedule
AND id_user = id_user_
AND i_type_alarm_schedule = in_i_type_alarm_schedule;
IF alm_exists_ = 0 THEN
UPDATE t_schedule_alert
SET x_alert_type = insertChildXML)
x_alert_type,
' / alert_types', 'type ',.
"< type >" | iv_alert_type | ' < / type > '
)
WHERE id_schedule = in_id_schedule
AND id_user = id_user_
AND i_type_alarm_schedule = in_i_type_alarm_schedule;
END IF;
END IF;
RETURN THE NUMBER OF ROWS SQL %;
END;
As soon as I delete the sms type:
declare
ID_ number;
Start
ID_: = pk_schedule_alert.update_alert (: b1,: b2, "sms",: b3, 0);
end;
The select above does not return anything and the simpler query:
Select *.
FROM xmltable ('/ alert_types/type ')
from (select x_alert_type in the t_schedule_alert where id_schedule =: = b1 and i_type_alarm_schedule: b2)
"path of columns type_ varchar2 (10) ' / text()".
) sa;
0 records returned.
Although the field of XMLtype:
"< alert_types >".
Email from < type > < / type >
"< / alert_types >.
If I add more once the type of sms:
declare
ID_ number;
Start
ID_: = pk_schedule_alert.update_alert (28.2, "sms", 12034, 1);
end;
The main query returns 1 for sms and 0 for the event by e-mail if the xml field contains:
"< alert_types >".
Email from < type > < / type >
< type > text < / type >
"< / alert_types >.
and the query:
Select *.
FROM xmltable ('/ alert_types/type ')
from (select x_alert_type in the t_schedule_alert where id_schedule =: = b1 and i_type_alarm_schedule: b2)
"path of columns type_ varchar2 (10) ' / text()".
) sa;
reutrns 1 record, sms
It seems that the crux of e-mail will be damaged some how by the removal of the sms you.
If I build the XML with sms, event and email node and delete the node of sms I have sms = 0, email = 0, event = 1 even if the xml field contains:
"< alert_types >".
Email from < type > < / type >
event < type > < / type >
"< / alert_types >.
I can't find the cause.
Hope to be clear enough and that you can help me.
Thanks in advance,
Samuel
Thanks, now I can reproduce.
XQuery Update has the problem too:
SQL > select id, column_value
t_temp_xml 2,
3 xmltable ('/ alert_types/type ' from config)
4 where id = 1;
ID COLUMN_VALUE
---------- --------------------------------------------------------------------------------
1
sms 1
SQL >
SQL > update t_temp_xml
2 set config = (xmlquery
3 'copy $d := . Edit)
4 remove the node $d/alert_types/type[.="sms"])
5 return $from
6 passage config
7 content of return
8 )
9 where id = 1;
1 line update
SQL >
SQL > select id, column_value
t_temp_xml 2,
3 xmltable ('/ alert_types/type ' from config)
4 where id = 1;
ID COLUMN_VALUE
---------- --------------------------------------------------------------------------------
Still another problem with the rewrite of XQuery I guess.
This works if you use the NO_XML_DML_REWRITE flag:
SQL > rollback;
Complete restoration
SQL >
SQL > UPDATE / * + no_xml_dml_rewrite * / t_temp_xml
2 SET config = deleteXML (config, ' / alert_types/type [. = "sms"]')
3 WHERE id = 1;
1 line update
SQL >
SQL > select id, column_value
t_temp_xml 2,
3 xmltable ('/ alert_types/type ' from config)
4 where id = 1;
ID COLUMN_VALUE
---------- --------------------------------------------------------------------------------
1
This should be reported to Oracle's Support.
Maybe it's already fixed in paragraph 12.1, can't check at the moment.
Tags: Database
Similar Questions
-
Hi all
My sql query tries to return the number of clients with their points total in some predefined intervals, so I created a table with the interval id and a threshold indicating the minimum threshold.
Customer table:
..client Total points client1 3 client2 15 Client 3 47
Table of interval:
My sql query looks like this:id threshold label 1 0 between 0 and 4 points 2 5 between 5 and 19 points 3 20 between 20 and 100 points
the problem is that this query returns the cumulative account, that is, all clients are considered in the interval from 0 (0-> 4points) and all those who have more than 5 points are in the range 2 and so on...SELECT max(interval.id), count(*) FROM clients, intervals WHERE Total points >= interval.threshold group by max 1
I do not know the DB with this select,
any help is appreciated
Thank youCheck out my post published on...
-
Problem with PL/SQL insert query
Hello to all the genius... Vikram im, Im new in the world of the apex and pl/sql... I need everything that you guys help... This is my first application user (for example)
name of the table - form
name of the column - f_no number, name varchar2, number of salary.
Apex page n - p1_f_no, p1_name, p1_sal
Now my problem is the query that is below works in the workshop of sql (insertion of data in the table in shape) and can be seen using the select query... but when I implement this in the apex... It shows - in all areas:
declare
v_no number (3);
v_Name varchar2 (20);
v_sal number (10);
Start
Insert in the form values (: v_no,: v_name,: v_sal);
end;
IM using this query in the Process button,
Thank you
-Best regards,.
VikramMahir M. Quluzade have already responded.
Published by: Gokhan Atil on 03.May.2011 12:45
-
Problem with SELECT IN the query
Why am I always 0 for returnvalue in the following query?
create or replace
PACKAGE BODY AS MyPKGSelectCount PROCEDURE
(
returnValue OUT INTEGER
)
AS
BEGINSELECT COUNT (*) from myTable in returnvalue;
IF (SQL ROWCOUNT % > = 1).
THEN
returnValue: = 1;
ON THE OTHER
returnValue: = 0;
END IF;dbms_output.put_line ('returnvalue: ' | returnvalue);
END SelectCount;
END MyPKG;Hello
Sorry, I didn;' t notice you had clauses in the wrong order. The INTO clause comes before the FROM clause, like this:
SELECT COUNT (*)
in returnvalue
FROM MyTable;
-
Problem with hierarchical query in function PL\SQL
I have a simple table containing the ID of the parent
-Create table
create the table1 table:
(
ID NUMBER (12) not null,
year number 4.
month NUMBER (2),
parent_id NUMBER (12)
);
-Create/recreate primary, unique and foreign key constraints
change the table1 table:
Add primary key constraint PK_TABLE1 (ID);
change the table1 table:
Add the foreign key constraint FK_TABLE1_PARENT (PARENT_ID)
reference TABLE1 (ID);
data:
Insert into TABLE1 (id, year, month, parent_id)
values (5, 2015, 12, 3);
Insert into TABLE1 (id, year, month, parent_id)
values (6 (2015), 12, 4);
Insert into TABLE1 (id, year, month, parent_id)
values (3 (2015), 11, 1);
Insert into TABLE1 (id, year, month, parent_id)
values (4 (2015), 11, 2);
Insert into TABLE1 (id, year, month, parent_id)
values (1, 2015, 10, null);
Insert into TABLE1 (id, year, month, parent_id)
values (2 (2015), 10, null);
commit;
and query
with h as
(select t.id, t.year, t.month, CONNECT_BY_ROOT t.id as parent_id from table1 t
where t.year = 2015 and t.month = 12
and CONNECT_BY_ROOT t.year = 2015 and CONNECT_BY_ROOT t.month = 10
connect by prior t.id = t.parent_id)
Select * from:
Join table1 t left t.id = h.parent_id;
It works, but when I put this request in the procedure pl\sql
create or replace procedure is get_report (p_cur_out on sys_refcursor)
Start
Open the p_cur_out for
with h as
(select t.id, t.year, t.month, CONNECT_BY_ROOT t.id as parent_id from table1 t
where t.year = 2015 and t.month = 12
and CONNECT_BY_ROOT t.year = 2015 and CONNECT_BY_ROOT t.month = 10
connect by prior t.id = t.parent_id)
Select * from:
Join table1 t left t.id = h.parent_id;
end get_report;
/
They do not compile. And in the fall, with the exception
Errors of compilation for the PC of the PROCEDURE. GET_REPORT
[Error: PL/SQL: ORA-00600: internal error code, arguments: [qctcte1], [0], [], [], [], [], [], [], [], [], []]
Online: 6
Text: with h as
Error: PL/SQL: statement ignored
Online: 6
Text: with h as
My version of oracle
1 Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production 2 PL/SQL Release 11.2.0.3.0 - Production 3 CORE Production 11.2.0.3.0 4 AMT for Linux: Version 11.2.0.3.0 - Production 5 NLSRTL Version 11.2.0.3.0 - Production What is the problem with my request? Or database? How to solve this problem?
If you have access to MOS, you can search the reason of it. If you are using left join syntax instead of joining ANSI, owner Oracle procedure compiles and returns the result.
-
Problem with the simple query.
Hi all
I am facing problem with the query below
Select A.COL1, A.COL2
B.COL1, B.COL2
FROM TABLE1 A
TABLE 1 B
WHERE A.header = '123'
AND B.header = '123'
AND nvl (A.COL6, 'ABC') = 'ABC '.
AND NVL (B.COL6, 'DEF') = 'DEF '.
Basically, my requiremenyt is: I have only one table, TABLE1 here, which has a line two lines (for the same header) as "ABC" and another is "DEF". Table 1 has two columns (col1, col2) that should be displayed for both lines.
When the header has two records in table1 top query works. and but if I do not have a record for any header example there are a record for "abc" in col6 only. so my query above does not work because there is no record for 'DEF' in col6. But I want to again request to fecth the output (for b.col1 and b.col2 should have null values)
could you pls suggest me how to get the 4 columns.
Thanks in advance
Kind regards
UVA.
Try to place the status of outer join on column: analytical_criterion_code as
and nvl (AUDIT.analytical_criterion_code, 'AUDIT2') = 'verification2. '
.
.
and nvl (TRANS.analytical_criterion_code, 'TRANS2') = 'TRANS2.
In the sub query based on the opinions that you have given in post # 1, although there is no value "DEF * ' for col6 due to the condition of outer join on b.col6 (+) line is extracted with b.col [1,2,3] as NULL values. Try to remove the (+) sign b.col6 and test.
with t as)
Select 111 col1, col2 'aaa', 'ABC' col6 123 header of all the double union
Select 222 'bbb', 'DEF' col6, 123 double header
)
q as (select 123 double header)
Select A.COL1, A.COL2, A.COL6
B.COL1, B.COL2, b.COL6
q.header
T a
t b
q
where a.col6 (+) = 'ABC '.
and b.col6 (+) = "DEF."
and q.header = a.header (+)
and q.header = b.header (+)
-
problem with bind variables in the SQL query view object
Hi all
I use JDev 11.1.2.4.0.
I have a problem with bind variables in the SQL query view object.
This is my original SQL
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in ('20130930','20130929') group by t.legertype_id
In my view .xml object query tab, I am writing this
SELECT sum(t.TIME) , t.legertype_id FROM LEDGER t WHERE t.nctuser_id = '20022' AND to_char(t.insertdate,'YYYYMMDD') in :dddd group by t.legertype_id
Davis here is a variable of Type liaison: String, updatable and necessary.
I try to deal with Davis as ('20130930 ', ' 20130929') hoping the view object, run as my original SQL.
But failed. The view object retrieves 0 line after that I run.
Why?
Thank you! ('2original SQL0130930', '20130929') ('20130930 ', ' 20130929')
A variable binding cannot be used as this is why you must use years table. Check decompilation binary ADF: using oracle.jbo.domain.Array with ViewCriteria to see a solution.
Timo
-
Problem with REGEXP_SUBSTR related query.
I'm having a problem with this query:
SELECT *.
FROM (SELECT REGEXP_SUBSTR ('{SUMMER} |)) {} POINT OF SALE}',
'({)([A-Z]+ *[A-Z]*)(})',
1,
LEVEL,
'I,
2)
Val
OF THE DOUBLE
CONNECT BY LEVEL < =.
REGEXP_COUNT ('{SUMMER} |) {} POINT OF SALE} ',' |') + 1)
WHERE val IS NOT NULL
I need the output in 2 rows in this format:
VAL
====
SUMMER
POINT OF SALE
But I'm not able to get the "POINT OF SALE" in the output due to space, or perhaps another reason. Anyone can correct my query?
So, you want something like that?
SQL > ed
A written file afiedt.buf1. SELECT *.
2 (SELECT REGEXP_SUBSTR ('{SUMMER} |)) {} POS} ',' [^ {|}] + ", LEVEL, 1, 'i') val"
3 FROM TWO
4. CONNECT BY LEVEL<>
5 REGEXP_COUNT ('{SUMMER} |) {} POINT OF SALE} ',' [^ |] +'))
6 * val WHERE IS NOT NULL
SQL > /.VAL
------------------------
SUMMER
POINT OF SALESQL >
-
Problem with the input query mode. FRM 41009, 40301
Hi all
I have a problem with the mode of input query. What can I say, I'm in the mode of input query, and I click on a button. I get the error THAT FRM-41009 displayed.
Now, I've wanted handled. So I created a trigger of error in order to handle the error.
IF ERR_CODE = 41009 THEN
NULL;
END IF;
A problem is that when you use the null value, it will not terminate the mode of input query, and then I get frm-40301 error.
Second, it's that I can't use exit_form in a trigger of the error.
I am aware that I can press F4 to exit this mode, but I don't want to do whenever I'm sure I'll get the user complaints.
Another solution would be to put the following code in the trigger when key pressed for each button in the form:
If: system.mode = "ENTER-QUERY" then
exit_form;
end if;
But I don't want to reproduce this code in my form.
Please can you give me an idea how to handle this correctly?
Thank you
Michael
PS: Version of the form = > ORACLE FORMS 10g (Forms [32 bit] Version 10.1.2.3.0)I have a problem with the mode of input query. What can I say, I'm in the mode of input query, and I click on a button. I get the error THAT FRM-41009 displayed.
What is the code in the trigger of your button When-Button-Pressed (WBP)? Maybe you should check to see if the form is in the Mode query in your WBP rather than try and remove the error? In other words, eliminate error - do not delete it. :)
If you want instead to remove the error, there is a technique to built-ins call restricted to a trigger that does not allow them. Do this by the use of a millisecond zero Timer. For example:
/* Sample On-Error Trigger */ DECLARE n_err_cd NUMBER := ERROR_CODE; t_on_error TIMER; ZERO NUMBER := 0; BEGIN IF ( n_err_cd = 41009 ) THEN /* Create Timer to execute Exit_Form() */ /* to Cancel Query-Mode. */ t_timer := Create_Timer('ON_ERROR', ZERO, NO_REPEAT); ELSE /* Handle all other errors here... */ END IF; END;
/* Sample When-Timer-Expired Trigger */ DECLARE v_Timer VARCHAR2(30); BEGIN v_timer := Get_Application_Property(TIMER_NAME); IF ( v_timer = 'ON_ERROR' ) THEN /* Notice, the timer name is case sensative! */ Exit_Form; END IF; END;
I am aware that I can press F4 to exit this mode, but I don't want to do whenever I'm sure I'll get the user complaints.
Well, it's just standard features of Oracle Forms. If you switch the Mode request form - you must run a query or cancel the query Mode! This is how it works. Your users need to understand that and accept it - just as they accept the functional also for other programs. ;) Another option would be to add a "Cancel request" button to your form and make it so it is enabled only when the form is placed in Query Mode. Just a thought...
I personally prefer to prevent the occurrence of an error rather than remove the error. :)
I hope this helps.
Craig... -
Hello!
I m facing a problem with the help of oraext: query-database.
In my transformation im try the following (Simplified):
How to get the correct value when you use oraext:query - database?<xsl:template match="*"> <xsl:variable sqlQuery="select ....."/> <xsl:variable name="storeSec" select="oraext:query-database($sqlQuery,true(),true(),'jdbc/xref')/> <xsl:choose> <xsl:when test="string-length($storeSec/ROWSET/ROW[1]/STORE_PART_SECTION) > 0"> <xsl:value-of select="$storeSec/ROWSET/ROW[1]/STORE_PART_SECTION"/> </xsl:when> <xsl:otherwise> <xsl:value-of select"some other val"/> </xsl:otherwise> </xsl:choose> </xsl:template> {code} This always results in +some+ +other+ +val+ !! I´v checked the output from oraext:query-database by using getcontentAsString and if I instead test putting the expected output from oraext:queryDatabase in my variable it gives me A100 which is what i expected. {code} <xsl:template match="*"> <xsl:variable sqlQuery=select ....."/> <xsl:variable name="storeSec"> <ROWSET> <ROW num="1"> <STORE_PART_SECTION>A100</STORE_PART_SECTION> </ROW> <ROW num="2"> <STORE_PART_SECTION>XXm</STORE_PART_SECTION> </ROW> </ROWSET> </xsl:variable> <xsl:choose> <xsl:when test="string-length($storeSec/ROWSET/ROW[1]/STORE_PART_SECTION) > 0"> <xsl:value-of select="$storeSec/ROWSET/ROW[1]/STORE_PART_SECTION"/> </xsl:when> <xsl:otherwise> <xsl:value-of select"some other val"/> </xsl:otherwise> </xsl:choose> </xsl:template>
How should you exit? Several item ID with each having a value of the result set?
If Yes, then you can try following: -
PROBLEM WITH SQL QUERY.
Hi all
I am executing the following query, which I use to retrieve unique records.
SELECT OH. ORDER_ID, OH. ORDER_DATE, OH. GRAND_TOTAL, OSI. DESCRIPTION ACE ORDER_STATUS,
PMT. DESCRIPTION AS PAYMENT_METHOD, TR. AS PAYMENT_STATUS DESCRIPTION
OF ORDER_HEADER OH INNER JOIN ORDER_PAYMENT_PREFERENCE OPP ON OH. ORDER_ID = OPP. ORDER_ID and
OPP. CREATED_DATE = (SELECT MAX (CREATED_DATE) OF ORDER_PAYMENT_PREFERENCE WHERE THE ORDER_ID = OH. ORDER_ID)
PAYMENT_METHOD_TYPE PMT, STATUS_ITEM SO, STATUS_ITEM OSI
WHERE OPP. PAYMENT_METHOD_TYPE_ID = PMT. PAYMENT_METHOD_TYPE_ID AND
OPP. BATCH = IF. BATCH AND OH. BATCH = OSI. BATCH AND
(OH. BATCH = "ORDER_CREATED" | OH. BATCH = "ORDER_HOLD") AND
OH. "CREATED_STAMP > = ' 2011-12-03 11:41:04.
Problem I am facing is, for some a few order_ids we have several entries in ORDER_PAYMENT_PREFERENCE with CREATED_DATE even where query return me of duplicate records.
I applied OPP. "CREATED_DATE = (SELECT MAX (CREATED_DATE) OF ORDER_PAYMENT_PREFERENCE WHERE THE ORDER_ID = OH. ORDER_ID)' forced to get the record, unique, but as I said to few recordings, we have several lines in ORDER_PAYMENT_PREFERENCE corr. ORDER_ID single and multiple records have same CREATED_DATE.
Can you suggest a few changes, the query to retrieve unique records.
I know I'm a very abstract information, shortly I'll provide table structure and little info I want in this query.
It's because of the tight work schedule.
Thank you
Jagdeep SinghHello
Basically, you need to convert a number in his order inside each created_date order_payment_preference. However, if you have more than one created_date which is him even you'll actually choose one of them at random unless you specify an order more squeezed by the clause. For example, you might have a numeric value from a sequence that could be added to determine which input was really the most recent. In any case the following should give you an idea what I mean...
SELECT order_id, order_date, grand_total, order_status, payment_method, payment_status FROM ( SELECT oh.order_id, oh.order_date, oh.grand_total, osi.description AS order_status, pmt.description AS payment_method, si.description AS payment_status ROW_NUMBER() OVER(PARTITION BY opp.order_id ORDER BY opp.created_date DESC) rn FROM order_header oh JOIN order_payment_preference opp ON oh.order_id = opp.order_id JOIN payment_method_type pmt ON opp.payment_method_type_id = pmt.payment_method_type_id JOIN status_item si ON opp.status_id = si.status_id JOIN status_item osi ON oh.status_id = osi.status_id WHERE AND oh.status_id IN('ORDER_CREATED','ORDER_HOLD') AND oh.created_stamp >= '2011-12-03 11:41:04' ) WHERE rn = 1
Some notes if - it is not a good idea to mix the styles of the junction between ansi and oracle style, it makes it difficult to follow. Just choose one or the other.
OH.STATUS_ID='ORDER_CREATED' || OH.STATUS_ID='ORDER_HOLD'
Makes no sense. I took a guess that you meant, OR then I converted to an IN clause that will do the same job.
HTH
David
-
Problem with XMLTABLE and LEFT OUTER JOIN
Hi all.
I have a problem with XMLTABLE and LEFT OUTER JOIN, in 11g it returns the correct result, but in 10g it doesn't, it is illustrated as a INNER JOIN.
This is all nice, now the problem:SELECT * FROM v$version; Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production PL/SQL Release 11.2.0.1.0 - Production "CORE 11.2.0.1.0 Production" TNS for Linux: Version 11.2.0.1.0 - Production NLSRTL Version 11.2.0.1.0 - Production --test for 11g CREATE TABLE XML_TEST( ID NUMBER(2,0), XML XMLTYPE ); INSERT INTO XML_TEST VALUES ( 1, XMLTYPE (' <msg> <data> <fields> <id>g1</id> <dat>data1</dat> </fields> </data> </msg> ') ); INSERT INTO XML_TEST VALUES ( 2, XMLTYPE (' <msg> <data> <fields> <id>g2</id> <dat>data2</dat> </fields> </data> </msg> ') ); INSERT INTO XML_TEST VALUES ( 3, XMLTYPE (' <msg> <data> <fields> <id>g3</id> <dat>data3</dat> </fields> <fields> <id>g4</id> <dat>data4</dat> </fields> <fields> <dat>data5</dat> </fields> </data> </msg> ') ); SELECT t.id, x.dat, y.seqno, y.id_real FROM xml_test t, XMLTABLE ( '/msg/data/fields' passing t.xml columns dat VARCHAR2(10) path 'dat', id XMLTYPE path 'id' )x LEFT OUTER JOIN XMLTABLE ( 'id' passing x.id columns seqno FOR ORDINALITY, id_real VARCHAR2(30) PATH '.' )y ON 1=1 ; ID DAT SEQNO ID_REAL -- ----- ----- ------- 1 data1 1 g1 2 data2 1 g2 3 data3 1 g3 3 data4 1 g4 3 data5
As you can see in 10g that I don't have the last row, it seems that Oracle 10 g does not recognize the LEFT OUTER JOIN.Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi PL/SQL Release 10.2.0.1.0 - Production "CORE 10.2.0.1.0 Production" TNS for HPUX: Version 10.2.0.1.0 - Production NLSRTL Version 10.2.0.1.0 - Production --exactly the same environment as 11g (tables and rows) SELECT t.id, x.dat, y.seqno, y.id_real FROM xml_test t, XMLTABLE ( '/msg/data/fields' passing t.xml columns dat VARCHAR2(10) path 'dat', id XMLTYPE path 'id' )x LEFT OUTER JOIN XMLTABLE ( 'id' passing x.id columns seqno FOR ORDINALITY, id_real VARCHAR2(30) PATH '.' )y ON 1=1 ; ID DAT SEQNO ID_REAL -- ----- ----- ------- 1 data1 1 g1 2 data2 1 g2 3 data3 1 g3 3 data4 1 g4
Is this a bug?, Metalink says that sometimes we can have an ORA-0600, but in this case there is no error results returned, just incorrect.
Help, please.
Kind regards.What about try the original Oracle method for outer joins? Using (+) without the extra space
XMLTABLE(...COLUMNS ... id XMLTYPE PATH ... ) x, XMLTABLE(... PASSING x.id ...) (+) y
-
Unique problem with selction on the table (Query Page)
Unique problem with selction on the table (Query Page)
I have a VO data Bulletin Board, with a transitional attribute for selction unique column.
My requirement is that I need to identify the line that was selected in the table.
I associated with fireAction singleSelection column, such that whenever the user selects the line
I'm looking for that VO using some rowIterator.
But when running the loop of the transient VO that is mapped to the singleSelection variable is the show as "n" / NUll
for all the lines...
So how do you identify the selected line in singleSelection to a table.
-SasiIn the property inspector of the element for which you've put firePartialAction, you can find a property named "parameters". That mention primary key as your setting.
You can get the arameter using pageContext.getparameter (
); -Anand
-
problem with query select in the search
Hello
Here I use MYSQL database and when I insertind to the database date, it saves as "2009-11-10 00:00:00 ' and when I used to do this show in dateformat as November 10, 2009".
Here's the problem occurs, when I write a search like query
Select recruitername, interviewdate, skillset
details
where interviewdate = #form.interviewdate #.I'm not a problem with the date. could u please help me how to solve this problem.
Or, better yet, a
with a type date. WHERE interviewdate =
-
Dynamic SQL query returning (problem with list of value)
Hi, I have problems with my request. I want to do where statement based on my selectlist, but the problem is that I could not write the correct string in my where condition.
: P61_STATUS has this following display, return value
Bewerber Bewerber
PRA_Kandidat PRA_Kandidat
abgelehnt abgelehnt
angenommen angenommen
Thema-Thema
join online
Staaten Staaten
Sky sky
our our
resultDECLARE q varchar2(4000); list_betreuer htmldb_application_global.vc_arr2; list_semester htmldb_application_global.vc_arr2; list_status htmldb_application_global.vc_arr2; BEGIN -- variable to store the list list_betreuer := HTMLDB_UTIL.STRING_TO_TABLE(:P61_BETREUER); list_semester := HTMLDB_UTIL.STRING_TO_TABLE(:P61_SEMESTER); list_status := HTMLDB_UTIL.STRING_TO_TABLE(:P61_STATUS); -- Query begins q:= 'select p1.name, p1.vorname , a1.tel, a2.tel, '; q:= q||'ab.thema, ab.status, ab.typ, s.bezeichnung, p2.name '; q:= q||'from person p1, person p2, adresse a1, adresse a2, '; q:= q||'zuordnungp_a zpa1,zuordnungp_a zpa2, '; q:= q||'abschlussarbeit ab, semester s '; q:= q||'WHERE ab.SEMESTER = s.OBJECTID (+) '; q:= q||'AND ab.STUDENT = p1.OBJECTID (+) '; q:= q||'AND ab.BETREUER = p2.OBJECTID (+) '; q:= q||'and p1.objectid = zpa1.person (+) '; q:= q||'and zpa1.adresse = a1.objectid (+) '; q:= q||'and zpa1.art (+)= ''Privat'' '; q:= q||'and p1.objectid = zpa2.person (+) '; q:= q||'and zpa2.adresse = a2.objectid (+) '; q:= q||'and zpa2.art (+)= ''Geschäft'' '; -- Loop for betreuer list FOR i in 1..list_betreuer.count LOOP IF i = 1 THEN q:= q||'AND (ab.betreuer = '||list_betreuer(i); ELSE q:= q||' OR ab.betreuer = '||list_betreuer(i); END IF; END LOOP; if (list_betreuer.count>0)THEN q:= q||')'; END IF; -- Loop for semester list FOR i in 1..list_semester.count LOOP IF i = 1 THEN q:= q||'AND (ab.semester = '||list_semester(i); ELSE q:= q||'OR ab.semester = '||list_semester(i); END IF; END LOOP; if (list_semester.count>0)THEN q:= q||')'; END IF; -- Loop for status list FOR i in 1..list_status.count LOOP IF i = 1 THEN q:= q||'AND (ab.status = '||list_status(i)||''; ELSE q:= q||'OR ab.status = '||list_status(i)||''; END IF; END LOOP; if (list_status.count>0)THEN q:= q||')'; END IF; htp.p(q); return q; END;
the problem is in this summaryselect p1.name, p1.vorname , a1.tel, a2.tel, ab.thema, ab.status, ab.typ, s.bezeichnung, p2.name from person p1, person p2, adresse a1, adresse a2, zuordnungp_a zpa1,zuordnungp_a zpa2, abschlussarbeit ab, semester s WHERE ab.SEMESTER = s.OBJECTID (+) AND ab.STUDENT = p1.OBJECTID (+) AND ab.BETREUER = p2.OBJECTID (+) and p1.objectid = zpa1.person (+) and zpa1.adresse = a1.objectid (+) and zpa1.art (+)= 'Privat' and p1.objectid = zpa2.person (+) and zpa2.adresse = a2.objectid (+) and zpa2.art (+)= 'Geschäft' AND (ab.status = abgegeben)
This statement produce this following statementq:= q||'AND (ab.status = '||list_status(i)||'';
But what I need, is this statementab.status = abgegeben
How can I get this statement?ab.status = 'abgegeben';
Thank you very muchTo use double quotes:
q:= q||'AND (ab.status = '''||list_status(i)||'''';
Maybe you are looking for
-
When I use my Mozilla e-mail account, the print is extremely low. I want to know how to change the font for that printing will appear larger. When I use Internet Explorer for e-mail, I don't have this problem. Thank you
-
How to install the display on the satellite Pro 4600 driver?
I can't find the option to do so. Can someone explain to me on how I can do this?I don't see an option so on the control unit of the device.What option do? Thanks in advance! Any help will be greatly appreciated. Post edited by: Thierry
-
This program could not be downloaded
I have problems when you try to download any file. I get the following: "the program could not be downloaded. Is there anyone with a fix for this problem? Thank you Emil
-
I have divided my application in three applications. (1) USER INTERFACE (2) background (3) Library(contains Common code between UI and Background) UI and background are made but have no idea of the library. Rough idea, is that it contains the class t
-
Why aren't windows to let me use my Windows 7 product key?
First of all, I got my download of Windows 7 Professional of Dreamspark since I am in college for IT and burned it to a disc. I got it used it once on my old computer to reformat and it worked fine. However, I just built a new PC and use a new hard d