XML DB Insert and Select from SQLPlus in 10.1.0.5

Hello,
I have created a table (id number, xml_data XMLType). And after some tries am able to insert record using java over jdbc.
SQLPlus shows there is one record in this table. But select statements are not showing any data in the xml_data column. I tried using extract and extractValue with xpath, still no luck, Is there a way to see the entire xml document that I have stored in the xml_data column.
Thank you,

It's probably a namespace problem/issue. Use your namespace in the extract, extractvalue statement (See SQL Reference Guide for detailed syntax info)

Similar Messages

  • Inserting multiple selection from checkbox in to one column of the database

    Hi,
    how to insert multiple selection from checkbox into one column of the database.(I select array of values from checkbox ,then how to insert tat array of values iinto single column name).
    Anyone can u reply me
    Thanx

    hhhmmm.... is this what you mean?
    lets say you hava a checkbox1 with values value1, value2, value3 and you selected all there of them? then you want then to be stored in the database in one column?
    now the question is:
    Is it going to be one column one row?
    datafield
    value1,value2,value3
    Or one column multiple row?
    datafield
    value1
    value2
    value3
    Which is it?

  • Long time on buffer sort with a insert and select through a dblink

    I am doing a fairly simple "insert into select from" statement through a dblink, but something is going very wrong on the other side of the link. I am getting a huge buffer sort time in the explain plan (line 9) and I'm not sure why. When I try to run sql tuning on it from the other side of the dblink, I get an ora-600 error "ORA-24327: need explicit attach before authenticating a user".
    Here is the original sql:
    INSERT INTO PACE_IR_MOISTURE@PRODDMT00 (SCHEDULE_SEQ, LAB_SAMPLE_ID, HSN, SAMPLE_TYPE, MATRIX, SYSTEM_ID)
    SELECT DISTINCT S.SCHEDULE_SEQ, PI.LAB_SAMPLE_ID, PI.HSN, SAM.SAMPLE_TYPE, SAM.MATRIX, :B1 FROM SCHEDULES S
    JOIN PERMANENT_IDS PI ON PI.HSN = S.SCHEDULE_ID
    JOIN SAMPLES SAM ON PI.HSN = SAM.HSN
    JOIN PROJECT_SAMPLES PS ON PS.HSN = SAM.HSN
    JOIN PROJECTS P ON PS.PROJECT_SEQ = PS.PROJECT_SEQ
    WHERE S.PROC_CODE = 'DRY WEIGHT' AND S.ACTIVE_FLAG = 'C' AND S.COND_CODE = 'CH' AND P.WIP_STATUS IN ('WP','HO')
    AND SAM.WIP_STATUS = 'WP';
    Here is the sql as it appears on proddmt00:
    INSERT INTO "PACE_IR_MOISTURE" ("SCHEDULE_SEQ","LAB_SAMPLE_ID","HSN","SAMPLE_TYPE","MATRIX","SYSTEM_ID")
    SELECT DISTINCT "A6"."SCHEDULE_SEQ","A5"."LAB_SAMPLE_ID","A5"."HSN","A4"."SAMPLE_TYPE","A4"."MATRIX",:B1
    FROM "SCHEDULES"@! "A6","PERMANENT_IDS"@! "A5","SAMPLES"@! "A4","PROJECT_SAMPLES"@! "A3","PROJECTS"@! "A2"
    WHERE "A6"."PROC_CODE"='DRY WEIGHT' AND "A6"."ACTIVE_FLAG"='C' AND "A6"."COND_CODE"='CH' AND ("A2"."WIP_STATUS"='WP' OR "A2"."WIP_STATUS"='HO') AND "A4"."WIP_STATUS"='WP' AND "A3"."PROJECT_SEQ"="A3"."PROJECT_SEQ" AND "A3"."HSN"="A4"."HSN" AND "A5"."HSN"="A4"."HSN" AND "A5"."HSN"="A6"."SCHEDULE_ID";
    Here is the explain plan on proddmt00:
    PLAN_TABLE_OUTPUT
    SQL_ID cvgpfkhdhn835, child number 0
    INSERT INTO "PACE_IR_MOISTURE" ("SCHEDULE_SEQ","LAB_SAMPLE_ID","HSN","SAMPLE_TYPE","MATRIX","SYSTEM_ID")
    SELECT DISTINCT "A6"."SCHEDULE_SEQ","A5"."LAB_SAMPLE_ID","A5"."HSN","A4"."SAMPLE_TYPE","A4"."MATRIX",:B1
    FROM "SCHEDULES"@! "A6","PERMANENT_IDS"@! "A5","SAMPLES"@! "A4","PROJECT_SAMPLES"@! "A3","PROJECTS"@! "A2"
    WHERE "A6"."PROC_CODE"='DRY WEIGHT' AND "A6"."ACTIVE_FLAG"='C' AND "A6"."COND_CODE"='CH' AND
    ("A2"."WIP_STATUS"='WP' OR "A2"."WIP_STATUS"='HO') AND "A4"."WIP_STATUS"='WP' AND
    "A3"."PROJECT_SEQ"="A3"."PROJECT_SEQ" AND "A3"."HSN"="A4"."HSN" AND "A5"."HSN"="A4"."HSN" AND
    "A5"."HSN"="A6"."SCHEDULE_ID"
    Plan hash value: 3310593411
    | Id | Operation | Name | Rows | Bytes |TempSpc| Cost (%CPU)| Time | Inst |IN-OUT|
    | 0 | INSERT STATEMENT | | | | | 5426M(100)| | | |
    | 1 | HASH UNIQUE | | 1210K| 118M| 262M| 5426M (3)|999:59:59 | | |
    |* 2 | HASH JOIN | | 763G| 54T| 8152K| 4300M (1)|999:59:59 | | |
    | 3 | REMOTE | | 231K| 5429K| | 3389 (2)| 00:00:41 | ! | R->S |
    | 4 | MERGE JOIN CARTESIAN | | 1254G| 61T| | 1361M (74)|999:59:59 | | |
    | 5 | MERGE JOIN CARTESIAN| | 3297K| 128M| | 22869 (5)| 00:04:35 | | |
    | 6 | REMOTE | SCHEDULES | 79 | 3002 | | 75 (0)| 00:00:01 | ! | R->S |
    | 7 | BUFFER SORT | | 41830 | 122K| | 22794 (5)| 00:04:34 | | |
    | 8 | REMOTE | PROJECTS | 41830 | 122K| | 281 (2)| 00:00:04 | ! | R->S |
    | 9 | BUFFER SORT | | 380K| 4828K| | 1361M (74)|999:59:59 | | |
    | 10 | REMOTE | PROJECT_SAMPLES | 380K| 4828K| | 111 (0)| 00:00:02 | ! | R->S |
    Predicate Information (identified by operation id):
    2 - access("A3"."HSN"="A4"."HSN" AND "A5"."HSN"="A6"."SCHEDULE_ID")

    Please use code tags... your formatted message is below:
    From the looks of your explain plan... these entries :
    Id      Operation      Name      Rows      Bytes     TempSpc      Cost (%CPU)      Time      Inst     IN-OUT
    4      MERGE JOIN CARTESIAN            1254G      61T            1361M (74)     999:59:59           
    5      MERGE JOIN CARTESIAN            3297K      128M            22869 (5)      00:04:35            Are causing extensive cpu processing, probably due to the cartesian join (includes sorting)... does "61T" mean 61 terabytes? Holy hell
    From the looks of the explain plan these tables don't look partitioned.... can you confirm?
    Why are you selecting distinct? If this is for ETL or data warehouse related procedure it ain't a good idea to use distinct... well ever... it's horrible for performance.
    INSERT INTO PACE_IR_MOISTURE@PRODDMT00 (SCHEDULE_SEQ, LAB_SAMPLE_ID, HSN, SAMPLE_TYPE, MATRIX, SYSTEM_ID)
    SELECT DISTINCT S.SCHEDULE_SEQ, PI.LAB_SAMPLE_ID, PI.HSN, SAM.SAMPLE_TYPE, SAM.MATRIX, :B1 FROM SCHEDULES S
    JOIN PERMANENT_IDS PI ON PI.HSN = S.SCHEDULE_ID
    JOIN SAMPLES SAM ON PI.HSN = SAM.HSN
    JOIN PROJECT_SAMPLES PS ON PS.HSN = SAM.HSN
    JOIN PROJECTS P ON PS.PROJECT_SEQ = PS.PROJECT_SEQ
    WHERE S.PROC_CODE = 'DRY WEIGHT' AND S.ACTIVE_FLAG = 'C' AND S.COND_CODE = 'CH' AND P.WIP_STATUS IN ('WP','HO')
    AND SAM.WIP_STATUS = 'WP';
    Here is the sql as it appears on proddmt00:
    INSERT INTO "PACE_IR_MOISTURE" ("SCHEDULE_SEQ","LAB_SAMPLE_ID","HSN","SAMPLE_TYPE","MATRIX","SYSTEM_ID")
    SELECT DISTINCT "A6"."SCHEDULE_SEQ","A5"."LAB_SAMPLE_ID","A5"."HSN","A4"."SAMPLE_TYPE","A4"."MATRIX",:B1
    FROM "SCHEDULES"@! "A6","PERMANENT_IDS"@! "A5","SAMPLES"@! "A4","PROJECT_SAMPLES"@! "A3","PROJECTS"@! "A2"
    WHERE "A6"."PROC_CODE"='DRY WEIGHT' AND "A6"."ACTIVE_FLAG"='C' AND "A6"."COND_CODE"='CH' AND ("A2"."WIP_STATUS"='WP' OR "A2"."WIP_STATUS"='HO') AND "A4"."WIP_STATUS"='WP' AND "A3"."PROJECT_SEQ"="A3"."PROJECT_SEQ" AND "A3"."HSN"="A4"."HSN" AND "A5"."HSN"="A4"."HSN" AND "A5"."HSN"="A6"."SCHEDULE_ID";
    Here is the explain plan on proddmt00:
    PLAN_TABLE_OUTPUT
    SQL_ID cvgpfkhdhn835, child number 0
    INSERT INTO "PACE_IR_MOISTURE" ("SCHEDULE_SEQ","LAB_SAMPLE_ID","HSN","SAMPLE_TYPE","MATRIX","SYSTEM_ID")
    SELECT DISTINCT "A6"."SCHEDULE_SEQ","A5"."LAB_SAMPLE_ID","A5"."HSN","A4"."SAMPLE_TYPE","A4"."MATRIX",:B1
    FROM "SCHEDULES"@! "A6","PERMANENT_IDS"@! "A5","SAMPLES"@! "A4","PROJECT_SAMPLES"@! "A3","PROJECTS"@! "A2"
    WHERE "A6"."PROC_CODE"='DRY WEIGHT' AND "A6"."ACTIVE_FLAG"='C' AND "A6"."COND_CODE"='CH' AND
    ("A2"."WIP_STATUS"='WP' OR "A2"."WIP_STATUS"='HO') AND "A4"."WIP_STATUS"='WP' AND
    "A3"."PROJECT_SEQ"="A3"."PROJECT_SEQ" AND "A3"."HSN"="A4"."HSN" AND "A5"."HSN"="A4"."HSN" AND
    "A5"."HSN"="A6"."SCHEDULE_ID"
    Plan hash value: 3310593411
    Id      Operation      Name      Rows      Bytes     TempSpc      Cost (%CPU)      Time      Inst     IN-OUT
    0      INSERT STATEMENT                              5426M(100)                 
    1      HASH UNIQUE            1210K      118M      262M      5426M (3)     999:59:59           
    * 2      HASH JOIN            763G      54T      8152K      4300M (1)     999:59:59           
    3      REMOTE            231K      5429K            3389 (2)      00:00:41      !      R->S
    4      MERGE JOIN CARTESIAN            1254G      61T            1361M (74)     999:59:59           
    5      MERGE JOIN CARTESIAN            3297K      128M            22869 (5)      00:04:35           
    6      REMOTE      SCHEDULES      79      3002            75 (0)      00:00:01      !      R->S
    7      BUFFER SORT            41830      122K            22794 (5)      00:04:34           
    8      REMOTE      PROJECTS      41830      122K            281 (2)      00:00:04      !      R->S
    9      BUFFER SORT            380K      4828K            1361M (74)     999:59:59           
    10      REMOTE      PROJECT_SAMPLES      380K      4828K            111 (0)      00:00:02      !      R->S
    Predicate Information (identified by operation id):
    2 - access("A3"."HSN"="A4"."HSN" AND "A5"."HSN"="A6"."SCHEDULE_ID")Edited by: TheDudeNJ on Oct 13, 2009 1:11 PM

  • Insert and select in one statement

    using MS Sql server and VB i can execute two queries Insert and select in one statement e.g. (insert into (....) values (...) Select @@Identity).
    how can i do the same thing using Oracle and VB. ???
    It gives error. here's what i want to do.
    (insert into table1 (...) values (...) Select table1_sequence.currval from dual )
    Khurram

    Here's how you can achieve the same Oracle :-
    Test Db>desc tmp1;
    Name Null? Type
    EMP_NO VARCHAR2(10)
    EID NUMBER
    Test Db>insert into tmp1 (emp_no, eid)
    2 select '123', 1
    3 from dual;
    1 row created.
    Shailender Mehta

  • Creating and selecting from a dynamic table

    Hi,
    Iam trying to create a table dynamically and selecting from it in same plsql block, but am getting "table doesnot exist" error. however if i just create a table dynamically and then do a select on it seperately it works..
    below is sample code for the same,
    working
    Line: -----
    DECLARE
    loc VARCHAR2(20):='bglr';
    l_cnt pls_integer;
    BEGIN
    -- create an employee information table
    EXECUTE IMMEDIATE
    'CREATE TABLE ' || 'emp_bglr' ||
    empno NUMBER(4) NOT NULL,
    ename VARCHAR2(10),
    job VARCHAR2(9),
    sal NUMBER(7,2),
    deptno NUMBER(2)
    end;
    select count(*) from emp_bglr ...works and return me 0 rows
    Line: -----
    but when i include select in plsql block ..it throws "Table does not exists" error...(iam running below plsql block after dropping the created table)
    not working
    Line: -----
    DECLARE
    loc VARCHAR2(20):='bglr';
    l_cnt pls_integer;
    BEGIN
    -- create an employee information table
    EXECUTE IMMEDIATE
    'CREATE TABLE ' || 'emp_bglr' ||
    empno NUMBER(4) NOT NULL,
    ename VARCHAR2(10),
    job VARCHAR2(9),
    sal NUMBER(7,2),
    deptno NUMBER(2)
    --COMMIT;
    END;
    Select count(*) into l_cnt from emp_bglr;
    dbms_output.put_line('cnt is '||l_cnt);
    end;
    Line: -----

    Becuase your code is first checked for syntax/object existance during compilation and throws an error saying the table does not exist.
    Try this:
    SQL> ed
    Wrote file afiedt.buf
      1   DECLARE
      2   loc VARCHAR2(20):='bglr';
      3   l_cnt pls_integer;
      4   BEGIN
      5   -- create an employee information table
      6   EXECUTE IMMEDIATE 'CREATE TABLE emp_bglr(
      7   empno NUMBER(4) NOT NULL,
      8   ename VARCHAR2(10),
      9   job VARCHAR2(9),
    10   sal NUMBER(7,2),
    11   deptno NUMBER(2)
    12   )';
    14  Select count(*) into l_cnt from all_objects where object_name = 'EMP_BGLR';
    15  dbms_output.put_line('tab cnt is '||l_cnt);
    16  IF (l_cnt = 1) THEN
    17  l_cnt := 0;
    18  EXECUTE IMMEDIATE 'SELECT count(*) from apps.emp_bglr' into l_cnt;
    19  dbms_output.put_line('data cnt is '||l_cnt);
    20  END IF;
    21* end;
    SQL> /
    tab cnt is 1
    data cnt is 0
    PL/SQL procedure successfully completed.
    SQL> Edited by: AP on Aug 5, 2010 5:51 AM
    Edited by: AP on Aug 5, 2010 5:52 AM

  • Inserting and Selecting LONG with PRO*C

    Is there any special hints in order to use
    the LONG datatype with pro*c ? Can I insert
    and select this kind of type like any other
    CHAR/VARCHAR/VARCHAR2, even if this field
    has a length of about 65536 chars ?

    Well, random because it is not always the same nor the error code.
    - Sometimes I get segmentation fault on "sqlcxt";
    - "ORA-01024: invalid datatype in OCI call" on queries that usually work
    - "ORA-03114: not connected to ORACLE" on queries that usually work
    I have run valgrind and the only "place" where there could be an issue is reported to be caused by oracle libs:
    ==27055== 8,214 bytes in 1 blocks are possibly lost in loss record 193 of 206
    ==27055== at 0x40046FF: calloc (vg_replace_malloc.c:279)
    ==27055== by 0x43E2975: nsbal (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42F04E6: nsiorini (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x4300FD2: nsopenalloc_nsntx (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42FFD73: nsopenmplx (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42F91FD: nsopen (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42BDAFE: nscall1 (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x42BB0D7: nscall (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x435F653: niotns (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x43F9E40: nigcall (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x436AD4B: osncon (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)
    ==27055== by 0x41EAA31: kpuadef (in /home/oracle/app/oracle/product/11.1.0/db_1/lib/libclntsh.so.11.1)

  • URGENT !! Capture the insert and select on database

    Hi,
    I need to capture the inserts and selects on the database.
    What are the options available on 9i?
    Thanks in advance!

    I don;t know how many times I've had to say this, but since I've had to say it to my boss, it bears repeating here:
    The SPFILE makes absolutely zero, null, nought difference to whether or not something is changeable dynamically or not. Not one bit, one whit or one iota.
    Parameters are as static or as dynamic as they were when init.oras rules the roost. Check in V$PARAMETER: if the thing says ISSYSMODIFIABLE is TRUE, then the parameter can be altered with an alter system command -and that's true whether you're using an init.ora or an spfile. If it says ISSYSMODIFIABLE=FALSE, then the parameter CANNOT be altered with an alter system command, and that's true whether you're using an init.ora or an spfile.
    Now comes the subtlety: if you add SCOPE=SPFILE to your alter system command then you aren't actually altering the system at all. All you're doing is asking the instance to edit the spfile. So an alter system set db_block_size=67238 scope=spfile will work, because you're not actually asking to alter the current block size at all. You're merely asking the instance to do what you would otherwise have done with notepad or gedit to a traditional init.ora.
    Only if you SCOPE=MEMORY is your alter system command actually trying to change the currently running instance.
    Of course, the trouble starts when you miss off a SCOPE clause, because then you get SCOPE=BOTH, which means MEMORY+SPFILE. But try that on a parameter which is SYSMODIFIABLE=FALSE: it won't work, because the MEMORY bit trips over the fact that the parameter is not system (dynamically) modifiable. Which just goes to prove that the existence of an SPFILE changes ABSOLUTELY NOTHING about whether a parameter can be dynamically modified or not.
    So no, the sentence "my database is using spfile and I have option to use alter system command" makes zero sense if, by it, you mean "I'm using an spfile so can I change things dynamically which I wouldn't be allowed to if I was stuck using a boring old init.ora"
    The answer is always and forever, "NO"!
    I blame a certain bouffant-haired so-called expert for first promulgating this myth that all parameters suddenly became dynamic in the presence of an spfile. It was never true when he wrote it. It isn't true now. It never will be true. It just happens to be the case that "alter system..scope=spfile" is Oracle's equivalent of "vi init.ora" as far as spfiles are concerned.

  • What is the defference between select single * from and select * from Where

    What is the defference between select single * from and select * from Where
    which is prefferable and best one.

    Hai,
    *Difference Between Select Single and Select * from table UpTo One Rows:*
    According to SAP Performance course the SELECT UP TO 1 ROWS is faster than SELECT SINGLE because you are not using all the primary key fields.
    select single is a construct designed to read database records with primary key. In the absence of the primary key, it might end up doing a sequential search, whereas the select up to 1 rows may assume that there is no primary key supplied and will try to find most suitable index.
    The best way to find out is through sql trace or runtime analysis.
    Use "select up to 1 rows" only if you are sure that all the records returned will have the same value for the field(s) you are interested in. If not, you will be reading only the first record which matches the criteria, but may be the second or the third record has the value you are looking for.
    The System test result showed that the variant Single * takes less time than Up to 1 rows as there is an additional level for COUNT STOP KEY for SELECT ENDSELECT UP TO 1 ROWS.
    The 'SELECT SINGLE' statement selects the first row in the database that it finds that fulfils the 'WHERE' clause If this results in multiple records then only the first one will be returned and therefore may not be unique.
    Mainly:  to read data from
    The 'SELECT .... UP TO 1 ROWS' statement is subtly different. The database selects all of the relevant records that are defined by the WHERE clause, applies any aggregate, ordering or grouping functions to them and then returns the first record of the result set.

  • 2 time zones during inserting and selecting the data.

    we have applied DST patch and DST JAVA patch sucessfuly on oracle 10.1.0.3 version database . After that we have problem
    It was noticed that it failing for the following 2 time zones during inserting and selecting the data.
    MST7
    HST10
    Please help me to solve this

    Try MetaLink. Lots of hits on ORA-1882.
    Specifically, Note 414590.1 "Time Zone IDs for 7 Time Zones Changed in Time Zone Files Version 3 and Higher, Possible ORA-1882 After Upgrade" sounds promising.
    -Mark

  • How to insert unicode charater from SQLPLUS

    Hi all,
    My problem is following :
    I want to store unicode character in a column of table so I create table with command : CREATE TABLE PERSON( ID NUMBER(4) NOT NULL ,NAME NVARCHAR2(64) NOT NULL).
    NLS_CHARACTERSET is set in DB :
    SQL> SELECT * FROM NLS_DATABASE_PARAMETERS;
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CHARACTERSET WE8ISO8859P1
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    PARAMETER VALUE
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZH:TZM
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZH:TZM
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_NCHAR_CHARACTERSET UTF8
    NLS_RDBMS_VERSION 8.1.7.0.0
    18 rows selected.
    when I insert data into above table (PERSON) with none unicode character is OK, but I failed with unicode character.
    Can anyone help me to solve this proplem?
    Thank you so much for any hints
    Pls email me at : [email protected]

    NLS_CHARACTERSET WE8ISO8859P1 is a western eurpoean character set (without the Euro symbol and about !# other funky characters being supported - use NLS_CHARACTERSET WE8ISO8859P1% if you want the Euro symbol, sorry just a sidenote). Anyways, this will need to be changed to UTF* before it can store Unicode characters. There are various ways to do this, but the best option is probably to export the entire database, create scripts to recreate all tablespaces and datafiles, drop the database, recreate the database in UTF8, then import the export file. There's a lot of little 'gotchas' involved so be prepared for it not to work the first time. But if it doesn't work, you can always create the database again with NLS_CHARACTERSET WE8ISO8859P1 and reimport so everything is back to how it was.

  • XML parsing failed while select from my table with criteria

    While select from my table an error displayed as
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00601: Invalid token in: '/<XML Path>/row[c24="SA0010001"]'
    select * from category
    where existsNode(xmlrecord, '/<XML Path>/row[c24="SA0010001"]') = 1;
    xmlrecord
    <row id="52843" xml:space="preserve">
    <c1>Refund of Domestic Payment Order</c1>
    <c2>Ref Dom Py Or</c2>
    <c3>PLsql</c3>
    <c20>1</c20>
    <c21>62_TAABSINPUTT___OFS_TAABS</c21>
    <c22>0803181605</c22>
    <c23>62_TAABSINPUTT_OFS_TAABS</c23>
    <c24>SA0010001</c24>
    <c25>1</c25>
    </row>

    Hi,
    Did you copy that sample from some demo?
    The part "<XML Path>" is meant to be replaced by a real XPath fragment.
    Here, I think you may just want this :
    select * from category
    where existsNode(xmlrecord, '/row[c24="SA0010001"]') = 1;Edit : OK, just seen your previous post and the example given
    Edited by: odie_63 on 6 juil. 2010 21:16

  • Designing a table for high rate of concurrent inserts and selects...

    I am looking for some recommendations on designing a table the will be inserted into from both nodes of a 2 node cluster quite heavily during peak hours when we are taking alot of orders. We are an online store and we are designing a table that will be used to hold product sku's for items that are placed in a shoppers cart at the same time and then we plan to use this table as a way of subtracting the inventory in this table as a minus in a view of our true nventory quantities?
    Not sure if that was clear but basically this table will be getting hit heavily for inserts and at the same time we will be using the data in the table to select from it so we can subtract the shu's that exists in the table.
    I am looking for techniques that maybe some of our guru's have implemented in this type of design in a rac environment that will help in the conncurrency that we are expectiing.
    Should I be building my tables with the smallest block size available as to avoid hot block in the db buffer cache and also we are using a sequence to generate and ID on the table and I have set a large cache size on the sequence (5000).
    We are planning on using ASSM table spaces with auto extent and segment space management as everthing we have read indicated that this is the best type of tablespace mgmt in RAC.
    What other factors should I be considering.
    any help or suggestions are greatly appreciated.
    Thanks in advance.

    user520056 wrote:
    I am looking for some recommendations on designing a table the will be inserted into from both nodes of a 2 node cluster quite heavily during peak hours when we are taking alot of orders. We are an online store and we are designing a table that will be used to hold product sku's for items that are placed in a shoppers cart at the same time and then we plan to use this table as a way of subtracting the inventory in this table as a minus in a view of our true nventory quantities?
    Not sure if that was clear but basically this table will be getting hit heavily for inserts and at the same time we will be using the data in the table to select from it so we can subtract the shu's that exists in the table.
    I am looking for techniques that maybe some of our guru's have implemented in this type of design in a rac environment that will help in the conncurrency that we are expectiing.
    Should I be building my tables with the smallest block size available as to avoid hot block in the db buffer cache and also we are using a sequence to generate and ID on the table and I have set a large cache size on the sequence (5000).
    We are planning on using ASSM table spaces with auto extent and segment space management as everthing we have read indicated that this is the best type of tablespace mgmt in RAC.
    What other factors should I be considering.
    any help or suggestions are greatly appreciated.
    Thanks in advance.See my .sig for other questions you should answer - OS, DB (version &c.),
    CPU/RAM/Disk...
    If you're running this on a 386 with 16 MB of RAM with on HDD, then you could
    have problems - if you're running it on something different, well that changes
    the possible answers.
    Paul...
    When asking database related questions, please give other posters
    some clues, like OS (with version), version of Oracle being used and DDL.
    Other trivia such as CPU + Disk configuration might also be useful.
    The exact text and/or number of error messages is useful (!= "it didn't work!"). Thanks.
    Furthermore, as a courtesy to those who spend time analysing and attempting to help,
    please do not top post and do try to trim your replies!

  • SQL Insert and Select statements on same page

    Newbie here.
    Is it possible to insert data from a form to a database and then get data from the database using "select" from the same page.
    I have a form that submits the authors details to an Access database but I need to get the AuthorID (which is an autonumber in the table) to show on the same page.
    <%@ page language="java" contentType="text/html" import="java.sql.*" %>
    <html>
    <head>
    <title>Confirm Details Submission</title>
    </head>
    </body>
    <%
    String title = request.getParameter("title");
    String surname = request.getParameter("surname");
    surname = surname.replaceAll("'", "''");
    String forename = request.getParameter("forename");
    forename = forename.replaceAll("'", "''");
    String address = request.getParameter("address");
    address = address.replaceAll("'", "''");
    String address2 = request.getParameter("address2");
    address2 = address2.replaceAll("'", "''");
    String town = request.getParameter("town");
    town = town.replaceAll("'", "''");
    String postcode = request.getParameter("postcode");
    String email = request.getParameter("email");
    email = email.replaceAll("'", "''");
    String dob = request.getParameter("dob");
    String telephone = request.getParameter("telephone");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection Conn = DriverManager.getConnection("jdbc:odbc:Novbase","","");
    Statement Stmt = Conn.createStatement();
    String Query = ("INSERT INTO Author (Title, Surname, Forename, Address, Address2, Town, Postcode, EMail, DOB, TelNo) VALUES ('" + title + "', '" + surname + "', '" + forename + "', '" + address + "', '" + address2 + "', '" + town + "', '" + postcode + "', '" + email + "', '" + dob + "', '" + telephone +"')");
    //Stmt.executeUpdate(Query) is where the records are inserted.
    int SQLStatus = Stmt.executeUpdate(Query);
         if(SQLStatus != 0)
    %>
    Thank you. Your Author ID number is ??
    <%
    else
    %>
    Error - Your details have not been submitted</font></h4>
    <br>
    Please click back on your browser and try again. If you experience further difficulties please go to our <a href ="help.html">help</a> pages.<br>
    <%
    Stmt.close(); Conn.close();
    %>
    </body>
    </html>

    Hi,
    You could execute queries as many times as you want using the same connection.
    For ex;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection Conn = DriverManager.getConnection("jdbc:odbc:Novbase","","");
    Statement Stmt = Conn.createStatement();
    String Query = ("INSERT INTO Author (Title, Surname, Forename, Address, Address2, Town, Postcode, EMail, DOB, TelNo) VALUES ('" + title + "', '" + surname + "', '" + forename + "', '" + address + "', '" + address2 + "', '" + town + "', '" + postcode + "', '" + email + "', '" + dob + "', '" + telephone +"')");
    //Stmt.executeUpdate(Query) is where the records are inserted.
    int SQLStatus = Stmt.executeUpdate(Query);
    if(SQLStatus != 0)
    Query = "SELECT Forname FROM Author;";
    ResultSet name = stmt.executeQuery(Query);
    //Now name will have all the Forname fields in the database. You could retrieve that using the get methods.
    %>
    Thank you. Your Author ID number is ??
    <%
    else
    %>
    Error - Your details have not been submitted</font></h4>
    <br>
    Please click back on your browser and try again. If you experience further difficulties please go to our <a href ="help.html">help</a> pages.<br>
    <%
    Stmt.close(); Conn.close();
    %>
    I hope that can help you.
    Rajesh

  • Views - SELECT from VIEW and SELECT from the query inside view definition returning different results

    Hi,
    I am facing this weird issue. Any help would be appriciated.
    I have view with the following definition:
    CREATE VIEW [marketing].[OpenedMails]
    AS
    SELECT
    ID_EmailAddress, 
    ID_Date_Opened, 
    ID_Contact, 
    ID_MailSendJobs,
    COUNT(ID_OpenedMails) AS OpenCount,
    CASE
    WHEN ROW_NUMBER() OVER (PARTITION BY CAST(ID_EmailAddress AS VARCHAR(10)) + ' ' + CAST(ID_MailSendJobs AS VARCHAR(10)) ORDER BY ID_Date_Opened) = 1 THEN 1 
    ELSE 0 
    END
    AS UniqueOpenCount
    FROM            
    dbo.Fact_OpenedMails
    where ID_Contact = 382340
    GROUP BY ID_EmailAddress, ID_Date_Opened, ID_Contact, ID_MailSendJobs;
    order by ID_MailSendJobs 
    When I run the the select statement in the view definition I get combination of both 1 and 0 for the 'UniqueOpenCount' column.
    But when I run the select from the view itself using the following query:
    SELECT [ID_EmailAddress]
          ,[ID_Date_Opened]
          ,[ID_Contact]
          ,[ID_MailSendJobs]
          ,[OpenCount]
          ,[UniqueOpenCount]
      FROM [marketing].[OpenedMails]
    I get equal amount of rows but only 0 values for the 'UniqueOpenCount' column which seems to be very weird to me. Why is this happening ? Can anyone help regarding how to solve this ??
    Result from the select inside view definition:
    Result from the select query directly from the view:
    Thanks in advance.
    Vivek Kamath

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You failed. Temporal
    data should use ISO-8601 formats – you failed again. Code should be in Standard SQL AS much AS possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    Things like “ID_Date_Opened” are wrong. The affixes “id” and “date” are called attribute properties in ISO-11179 and data modeling. Since a date is a unit of measurement on a temporal scale, it cannot be an identifier by definition. My guess is this would be
    “open_date” if it were done right. And the only display format in ANSI/ISO Standard SQL is ISO-8601 (yyyy-mm-dd)
    An email address of -1?? Email addresses are VARCHAR(256), not numeric. There is no reason to cast them AS string!
    Your vague “mail_send_jobs” is plural, but columns hold scalars and cannot be plural by definition. The partition cause can hold a list of columns: 
    WHEN ROW_NUMBER() 
         OVER (PARTITION BY email_address, mail_send_job 
                   ORDER BY open_date)
         = 1 
    THEN 1 ELSE 0 END 
    This still makes no sense, but the syntax is better. You do not understand how ROW_NUMBER() works. 
    Would you like to try again with proper Netiquette? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • 'select count(*) from x' returns 5460 rows and 'Select * from x' returns 0 rows

    As you can see in the next lines something is wrong in my Oracle (8.0.6 on Win NT 4.0 sp 6a) :
    Oracle8 Enterprise Edition Release 8.0.6.0.0 - Production
    With the Partitioning option
    PL/SQL Release 8.0.6.0.0 - Production
    SQLWKS> SELECT * FROM V_TERRA_TE;
    PERIOD_DATE PERIOD_TIME TERRARCV TERRASND TERCV TESND
    0 rows selected.
    SQLWKS> SELECT COUNT(*) FROM V_TERRA_TE;
    COUNT(*)
    5460
    1 row selected.
    V_TERRA_TE is a complex join of 5 Tables :
    CREATE OR REPLACE VIEW "ACTUATE".V_TERRA_TE AS Select to_date(to_char(p1.period_date,'YYYYMMDD'),'YYYYMMDD') "PERIOD_DATE",
    to_date(to_char(p1.period_time,'HH24:MI'),'HH24:MI') "PERIOD_TIME",
    to_number(p1.caudalrcv + ((p3.caudalrcv + p4.caudalrcv)*(confterrate.conexadslterra/confterrate.conexadsltotal))) "TERRARCV",
    to_number(p1.caudalsnd + ((p3.caudalsnd + p4.caudalsnd)*(confterrate.conexadslterra/confterrate.conexadsltotal))) "TERRASND",
    to_number((p2.caudalrcv * confterrate.pctinfonegocio) + ((p3.caudalrcv + p4.caudalrcv)*(confterrate.conexadslte/confterrate.conexadsltotal)))"TERCV",
    to_number((p2.caudalsnd * confterrate.pctinfonegocio) + ((p3.caudalsnd + p4.caudalsnd)*(confterrate.conexadslte/confterrate.conexadsltotal)))"TESND"
    from p1,p2,p3,p4,confterrate
    where (p1.period_date=p2.period_date)and
    (p1.period_date=p3.period_date)and
    (p1.period_date=p4.period_date)and
    (p1.period_time=p3.period_time)and
    (p1.period_time=p4.period_time)and
    (p1.period_time=p2.period_time)and
    to_char(p1.period_date,'MMYYYY')=to_char(confterrate.period_datetime,'MMYYYY');
    I think that some not reported error happens in the select * with some temporary space or similar but only the message '0 rows selected' is displayed (instead the real error)
    Could somebody help me ?
    Thanks in advance
    Francisco

    Forcing the Join/sort to be made on Disk (not on memory) the problem not happens. This demostrate that ORACLE has a VERY IMPORTANT BUG : It returns 0 rows wich is false.
    To force it to work on disk i use this parameters :
    alter session set sort_area_size=0
    alter session set hash_join_enabled=false
    Note : probably is not the best combination or use of parameters, but using it the query works as espected.

Maybe you are looking for