Problem in execution of a function having clob datatype
[http://www.orafaq.com/forum/t/128331/98870/]
Hi,
I had a Problem in executing a function having clob datatype.
Here below is my function.
create or replace type split_obj as object
occurence_id number(10,0),
splitvalue varchar2(1000)
create or replace type split_rec as table of split_obj;
create or replace FUNCTION Split_new1(
p_string IN clob,
p_delimiter IN VARCHAR2
) return split_rec pipelined is
v_length NUMBER := dbms_lob.getlength(p_string);
v_start NUMBER := 1;
v_index NUMBER;
V_temp NUMBER(10,0):=0;
begin
WHILE(v_start <= v_length)
LOOP
v_index := dbms_lob.INSTR(p_string, p_delimiter, v_start);
IF v_index = 0 THEN
V_temp:=V_temp+1;
PIPE ROW(split_obj(v_temp,dbms_lob.SUBSTR(p_string, v_length,v_start)));
v_start := v_length + 1;
ELSE
v_temp:=v_temp+1;
PIPE ROW(split_obj(v_temp,dbms_lob.SUBSTR(p_string, v_index - v_start,v_start)));
v_start := v_index + 1;
END IF;
END LOOP;
return;
end Split_new1;Here attached link contains the procedure trying to execute the function with huge string more than 400kb.
Could you pls let me know how to do the same in sqlplus and toad.
Thanks in advance.
Edited by: user512743 on Nov 27, 2008 4:31 AM
BluShadow wrote:
The problem is that in your execution of this you are trying to assign a value to the clob variable using
v_clob := '<string>'
where the string is greater than allowed in PL/SQL.
Whilst the CLOB itself can hold more data, the string is actually the equivalent of a VARCHAR2 so cannot exceed VARCHAR2 limits.
You should use the DBMS_LOB package to append data to your CLOB in chunks of no more than 32767 characters at a time.??? PL/SQL provides full CLOB support. There is no need to use DBMS_LOB (although you could). OP's function has logic errors. Anyway:
SQL> create or replace type split_obj as object
2 (
3 occurence_id number(10,0),
4 splitvalue varchar2(1000)
5 );
6 /
Type created.
SQL> create or replace type split_rec as table of split_obj;
2 /
Type created.
SQL> create or replace
2 FUNCTION Split_new1(
3 p_string IN clob,
4 p_delimiter IN VARCHAR2
5 )
6 return split_rec pipelined
7 is
8 v_length NUMBER := length(p_string);
9 v_start NUMBER := 1;
10 v_end NUMBER;
11 V_id NUMBER :=0;
12 v_clob CLOB := p_string || p_delimiter;
13 begin
14 while(v_start <= v_length) loop
15 v_end := instr(v_clob, p_delimiter, v_start);
16 v_id := v_id + 1;
17 pipe row(split_obj(v_id,substr(p_string,v_start,v_end - v_start)));
18 v_start := v_end + length(p_delimiter);
19 end loop;
20 return;
21 end Split_new1;
22 /
Function created.
SQL> create table test_table(x clob)
2 /
Table created.
SQL> declare
2 c clob;
3 begin
4 for i in 1..26 loop
5 c := c || lpad(chr(ascii('a') + i - 1),1000,chr(ascii('a') + i - 1)) || ',';
6 end loop;
7 for i in 1..26 loop
8 c := c || lpad(chr(ascii('A') + i - 1),1000,chr(ascii('A') + i - 1)) || ',';
9 end loop;
10 for i in 1..26 loop
11 c := c || lpad(chr(ascii('a') + i - 1),1000,chr(ascii('a') + i - 1)) || ',';
12 end loop;
13 for i in 1..26 loop
14 if i > 1 then c := c || ','; end if;
15 c := c || lpad(chr(ascii('A') + i - 1),1000,chr(ascii('A') + i - 1));
16 end loop;
17 insert into test_table
18 values(c);
19 end;
20 /
PL/SQL procedure successfully completed.
SQL> select length(x)
2 from test_table
3 /
LENGTH(X)
104103
SQL> select t.occurence_id,
2 length(splitvalue) len,
3 substr(splitvalue,1,20) first_20
4 from test_table,
5 table(Split_new1(x,',')) t
6 /
OCCURENCE_ID LEN FIRST_20
1 1000 aaaaaaaaaaaaaaaaaaaa
2 1000 bbbbbbbbbbbbbbbbbbbb
3 1000 cccccccccccccccccccc
4 1000 dddddddddddddddddddd
5 1000 eeeeeeeeeeeeeeeeeeee
6 1000 ffffffffffffffffffff
7 1000 gggggggggggggggggggg
8 1000 hhhhhhhhhhhhhhhhhhhh
9 1000 iiiiiiiiiiiiiiiiiiii
10 1000 jjjjjjjjjjjjjjjjjjjj
11 1000 kkkkkkkkkkkkkkkkkkkk
OCCURENCE_ID LEN FIRST_20
12 1000 llllllllllllllllllll
13 1000 mmmmmmmmmmmmmmmmmmmm
14 1000 nnnnnnnnnnnnnnnnnnnn
15 1000 oooooooooooooooooooo
16 1000 pppppppppppppppppppp
17 1000 qqqqqqqqqqqqqqqqqqqq
18 1000 rrrrrrrrrrrrrrrrrrrr
19 1000 ssssssssssssssssssss
20 1000 tttttttttttttttttttt
21 1000 uuuuuuuuuuuuuuuuuuuu
22 1000 vvvvvvvvvvvvvvvvvvvv
OCCURENCE_ID LEN FIRST_20
23 1000 wwwwwwwwwwwwwwwwwwww
24 1000 xxxxxxxxxxxxxxxxxxxx
25 1000 yyyyyyyyyyyyyyyyyyyy
26 1000 zzzzzzzzzzzzzzzzzzzz
27 1000 AAAAAAAAAAAAAAAAAAAA
28 1000 BBBBBBBBBBBBBBBBBBBB
29 1000 CCCCCCCCCCCCCCCCCCCC
30 1000 DDDDDDDDDDDDDDDDDDDD
31 1000 EEEEEEEEEEEEEEEEEEEE
32 1000 FFFFFFFFFFFFFFFFFFFF
33 1000 GGGGGGGGGGGGGGGGGGGG
OCCURENCE_ID LEN FIRST_20
34 1000 HHHHHHHHHHHHHHHHHHHH
35 1000 IIIIIIIIIIIIIIIIIIII
36 1000 JJJJJJJJJJJJJJJJJJJJ
37 1000 KKKKKKKKKKKKKKKKKKKK
38 1000 LLLLLLLLLLLLLLLLLLLL
39 1000 MMMMMMMMMMMMMMMMMMMM
40 1000 NNNNNNNNNNNNNNNNNNNN
41 1000 OOOOOOOOOOOOOOOOOOOO
42 1000 PPPPPPPPPPPPPPPPPPPP
43 1000 QQQQQQQQQQQQQQQQQQQQ
44 1000 RRRRRRRRRRRRRRRRRRRR
OCCURENCE_ID LEN FIRST_20
45 1000 SSSSSSSSSSSSSSSSSSSS
46 1000 TTTTTTTTTTTTTTTTTTTT
47 1000 UUUUUUUUUUUUUUUUUUUU
48 1000 VVVVVVVVVVVVVVVVVVVV
49 1000 WWWWWWWWWWWWWWWWWWWW
50 1000 XXXXXXXXXXXXXXXXXXXX
51 1000 YYYYYYYYYYYYYYYYYYYY
52 1000 ZZZZZZZZZZZZZZZZZZZZ
53 1000 aaaaaaaaaaaaaaaaaaaa
54 1000 bbbbbbbbbbbbbbbbbbbb
55 1000 cccccccccccccccccccc
OCCURENCE_ID LEN FIRST_20
56 1000 dddddddddddddddddddd
57 1000 eeeeeeeeeeeeeeeeeeee
58 1000 ffffffffffffffffffff
59 1000 gggggggggggggggggggg
60 1000 hhhhhhhhhhhhhhhhhhhh
61 1000 iiiiiiiiiiiiiiiiiiii
62 1000 jjjjjjjjjjjjjjjjjjjj
63 1000 kkkkkkkkkkkkkkkkkkkk
64 1000 llllllllllllllllllll
65 1000 mmmmmmmmmmmmmmmmmmmm
66 1000 nnnnnnnnnnnnnnnnnnnn
OCCURENCE_ID LEN FIRST_20
67 1000 oooooooooooooooooooo
68 1000 pppppppppppppppppppp
69 1000 qqqqqqqqqqqqqqqqqqqq
70 1000 rrrrrrrrrrrrrrrrrrrr
71 1000 ssssssssssssssssssss
72 1000 tttttttttttttttttttt
73 1000 uuuuuuuuuuuuuuuuuuuu
74 1000 vvvvvvvvvvvvvvvvvvvv
75 1000 wwwwwwwwwwwwwwwwwwww
76 1000 xxxxxxxxxxxxxxxxxxxx
77 1000 yyyyyyyyyyyyyyyyyyyy
OCCURENCE_ID LEN FIRST_20
78 1000 zzzzzzzzzzzzzzzzzzzz
79 1000 AAAAAAAAAAAAAAAAAAAA
80 1000 BBBBBBBBBBBBBBBBBBBB
81 1000 CCCCCCCCCCCCCCCCCCCC
82 1000 DDDDDDDDDDDDDDDDDDDD
83 1000 EEEEEEEEEEEEEEEEEEEE
84 1000 FFFFFFFFFFFFFFFFFFFF
85 1000 GGGGGGGGGGGGGGGGGGGG
86 1000 HHHHHHHHHHHHHHHHHHHH
87 1000 IIIIIIIIIIIIIIIIIIII
88 1000 JJJJJJJJJJJJJJJJJJJJ
OCCURENCE_ID LEN FIRST_20
89 1000 KKKKKKKKKKKKKKKKKKKK
90 1000 LLLLLLLLLLLLLLLLLLLL
91 1000 MMMMMMMMMMMMMMMMMMMM
92 1000 NNNNNNNNNNNNNNNNNNNN
93 1000 OOOOOOOOOOOOOOOOOOOO
94 1000 PPPPPPPPPPPPPPPPPPPP
95 1000 QQQQQQQQQQQQQQQQQQQQ
96 1000 RRRRRRRRRRRRRRRRRRRR
97 1000 SSSSSSSSSSSSSSSSSSSS
98 1000 TTTTTTTTTTTTTTTTTTTT
99 1000 UUUUUUUUUUUUUUUUUUUU
OCCURENCE_ID LEN FIRST_20
100 1000 VVVVVVVVVVVVVVVVVVVV
101 1000 WWWWWWWWWWWWWWWWWWWW
102 1000 XXXXXXXXXXXXXXXXXXXX
103 1000 YYYYYYYYYYYYYYYYYYYY
104 1000 ZZZZZZZZZZZZZZZZZZZZ
104 rows selected.
SQL> As you can see, function works OK without DBMS_LOB on CLOB of 104103 bytes.
SY.
Similar Messages
-
Hi,
I searched and found how to insert into clob datatype
SQL> create table employee(ename char(11),id number,info clob);
Table created.
SQL> insert into employee values('anil',100,empty_clob());
1 row created.
SQL> update employee set info='jkkkkkkkkkksdflfweuikddddddddddddddddddddddddddddaaaaaaaaaaaaaaaaaaaa';
1 row updated.
SQL> select * from employee;
ENAME ID
INFO
anil 100
jkkkkkkkkkksdflfweuikdddddddddddddaaaaaaaaaaaaaaaaaaaaaaaaaaaNow if i want to insert another row into this table having clob datatype,
Then how to insert into itWhat's the problem exactly?
SQL> create table employee (ename char(11), id number, info clob);
Table created.
SQL> insert into employee values ('anil',100,'here is some info');
1 row created.
SQL> insert into employee values ('fred',200,'here is freds info');
1 row created.
SQL> select * from employee;
ENAME ID INFO
anil 100 here is some info
fred 200 here is freds info
SQL> -
I want to upload a file to a clob field in the database and also I want to save the data in a clob field to a file using PSP. Is this possible. any body has done any work on this. Please help.
MohanPlease find the details :
1. What is your target Database... --Target database is oracle, so is source.
2. Your source column is having CLOB Datatype .. whether your target Column (Mapped cloumn is also CLOB) --Both the source and target datatypes are CLOB
3If your DB doesnt support the CLOB Dataype ... you can add New datatype under Topology --> Physical Architecture --> Technolgies
The Topology manager Technologies does have the CLOB datatype.Should any type casting be done in the map to support the same.
Thanks,
Smrithy -
Problem with dynamic LOV and function
Hello all!
I'm having a problem with a dynamic lov in APEX 3.0.1.00.08. Hope you can help me!
I have Report and Form application. On the Form page i have a Page Item (Popup Key LOV (Displays description, returns key value)).
When i submit the sql code in the 'List of vaules defention' box. I get the following message;
1 error has occurred
LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.
When i excecute the code below in TOAD or in the SQL Workshop it returns the values i want to see. But somehow APEX doesn't like the sql....
SELECT REC_OMSCHRIJVING d, REC_DNS_ID r FROM
TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
returns_dns_lov_fn is a function, code is below;
CREATE OR REPLACE FUNCTION DRSSYS.return_dns_lov_fn (p2_dns_id number)
RETURN dns_table_type
AS
v_data dns_table_type := dns_table_type ();
BEGIN
IF p2_dns_id = 2
THEN
FOR c IN (SELECT dns_id dns, omschrijving oms
FROM d_status dst
WHERE dst.dns_id IN (8, 10))
LOOP
v_data.EXTEND;
v_data (v_data.COUNT) := dns_rectype (c.dns, c.oms);
END LOOP;
RETURN v_data;
END IF;
END;
and the types;
CREATE OR REPLACE TYPE DRSSYS.dns_rectype AS OBJECT (rec_dns_id NUMBER, rec_omschrijving VARCHAR2(255));
CREATE OR REPLACE TYPE DRSSYS.dns_table_type AS TABLE OF dns_rectype;
I tried some things i found on this forum, but they didn't work as well;
SELECT REC_OMSCHRIJVING display_value, REC_DNS_ID result_display FROM
TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
SELECT REC_OMSCHRIJVING display_value d, REC_DNS_ID result_display r FROM
TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) order by 1
SELECT a.REC_OMSCHRIJVING display_value, a.REC_DNS_ID result_display FROM
TABLE(CAST(return_dns_lov_fn(:P2_DNS_ID) AS dns_table_type)) a order by 1
Edited by: rajan.arkenbout on 8-mei-2009 14:41
Edited by: rajan.arkenbout on 8-mei-2009 14:51I just had the same problem when I used a function in a where clause.
I have a function that checks if the current user has acces or not (returning varchar 'Y' or 'N').
In where clause I have this:
where myFunction(:user, somePK) = 'Y'
It seems that when APEX checked if my query was valid, my function triggered and exception.
As Varad pointed out, check for exception that could be triggered by a null 'p2_dns_id'
Hope that helped you out.
Max -
Using PL/SQL Function with CLOB types and a Java Source
Hi people.
I have some problems trying to use a function in pl/sql with a CLOB parameter to a java source function.
Here is the problem: I have to read a TXT file and return a CLOB with the data of the file. The reading is done with a java source function.
The problem is how to read the file without messing the content and return it to the pl/sql function?
Another problem: If I pass a CLOB as a parameter to a pl/sql function and have to write the content to a file, how to do it without screwing the EOL chars and so?
My code is:
/******** PLSQL FUNCTIONS ********/
function fn_gravaconteudoarquivo( pv_caminho in varchar2
, pv_nomearquivo in varchar2
, pc_conteudo in clob ) return varchar2 as language java
name 'Importacao.gravaConteudoArquivo(java.lang.String, java.lang.String, oracle.sql.CLOB) return varchar2';
function fn_lerconteudoarquivoclob( pv_caminho in varchar2
, pv_nomearquivo in varchar2 ) return clob as language java
name 'Importacao.lerArquivoClob(java.lang.String, java.lang.String) return clob';
/******** JAVA SOURCE FUNCTIONS *********/
public static String gravaConteudoArquivo(String caminho, String nomeArquivo, CLOB conteudo) {
File file = new File(caminho, nomeArquivo);
PrintWriter pwFile;
String mensagem = "";
StringBuffer sb = new StringBuffer();
try {
pwFile = new PrintWriter(new BufferedWriter(new FileWriter(file,true)));
for (int i=0;i<=(conteudo.length()/32000);i++) {
sb.append(conteudo.getSubString(conteudo.getLength()+1,32000));
pwFile.println(sb.substring(0));
pwFile.close();
} catch (Exception ex) {
mensagem = "Erro: "+ex;
return mensagem;
public static CLOB lerArquivoClob(String caminho, String nomeArquivo) throws SQLException {
File file = new File(caminho, nomeArquivo);
Connection conn;
CLOB clob = null;
String lineSep = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer();
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:csdesv", "csestoque", "liberada");
clob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
BufferedReader brFile = new BufferedReader(new FileReader(file.getPath()));
while (brFile.ready()) {
sb.append(brFile.readLine());
sb.append(lineSep);
clob.open(CLOB.MODE_READWRITE);
clob.setString(clob.getLength()+1, sb.toString());
clob.close();
} catch (Exception ex) {
ex.printStackTrace();
return clob;
Ah, just remembered... This will work as a JOB.... >.< ... So the connection aparently is at localhost.
Thanks.No one? I really need this....
-
NVL Function on CLOB data type
Hi all,
I am not able to use the NVL function over clob..please suggest me a way to do the data validation of the CLOB in sql ....
below is the query i was using...
select t1.pic_name,t2.pic_name
from table1 t1,table2 t2
where nvl(t1.picture_message,'X') <> nvl(t2.picture_message,'X');i am getting the following error....
ORA-00932: inconsistent datatypes: expected - got CLOBThanks
RedeYour problem is not NVL but rather comparing CLOBs:
SQL> desc tbl1
Name Null? Type
ID NUMBER
X CLOB
SQL> desc tbl2
Name Null? Type
ID NUMBER
X CLOB
SQL> select nvl(x,'NULL CLOB')
2 from tbl1
3 /
NVL(X,'NULLCLOB')
NULL CLOB
SQL> select *
2 from tbl1,
3 tbl2
4 where tbl1.x = tbl2.x
5 /
where tbl1.x = tbl2.x
ERROR at line 4:
ORA-00932: inconsistent datatypes: expected - got CLOB
SQL> SY. -
Problems using the reset password function on mac osx server.
Hey ,
Having problems with the reset password functions on the OSX server. When I try to do through the command line it asks for the old password of the user. So how do I fix the problem? Do I have to log in onto the ldap server as the admin and reset from there or is there an easy fix to make the reset password function work. When I try the reset password function the server is not taking the input when I click on change password. So any helpful suggestions are welcome. Verson OSX lion 10.7.5
Thanks in Advance,Excuse me for misunderstanding your post. You explicitly stated in your post
ashdatla wrote:
through the command line
and wrote that it asks for the old password. Server.app is not accessed through the command line, and it does not ask for the old password of the user.
You might like to try Workgroup Manager instead. -
Problem on CLOB datatype after import
I got problem and call to Oracle support and they use DUL for extract data from datafile to dump file and I import everything is done and no error but when I check in CLOB datatype that have space(blank character) separate each character see below
Original
Oracle
After Import
O R A C L E
So the application cannot execute those data.
Anyone have solution how to fix this problem?
Thanks,
Taohikoif you use a direct insert you are restricted to 4000 characters.
You can put your value in a varchar2 variable and that allows you to insert up to 32767 characters.
declare
my_clob_variable := rpad('x','X',25000);
begin
insert into my_table(my_clob_column)
values(my_clob_variable);
end; -
After having yet another problem with my MacBook Pro and having to wipe the drive, I am now unable to sync my iPhones etc without erasing all the music on them. Is there a way around this? I have no other library!
iTunes is a mess! It couldn't find it's own libraries and I was forced to create a new one. Now I don't know where my music is or if any's missing.columbus new boy wrote:
How crap is that?
It's not crap at all.
It's not that simple. For example, I've 3500 songs on my MacBook but don't want them all on my phone, so I have to manually select each song again???
There has to be a solution.
Why not simply make a playlist with the songs you want on the iPhone?
and maintain a current backup of your computer. -
Problem with tpcall and tpgetrply functions
Hi,
I have a problem with tpcall() and tpgetrply() functions.
In this example (invoke tpcall()):
FBFR32 *buf;
FLDLEN32 buflen;
buf = a_buffer.getBuffer(); /* getBuffer() returns FBFR32* */
buflen = a_buffer.getLongitud();
/* at this point: buf == a_buffer.getBuffer() */
if (tpcall(a_contenedor.getServname(),
(char*)a_contenedor.getBufferPeticion()->getBuffer(),
a_contenedor.getBufferPeticion()->getLongitud(),
(char**)&buf,
(long*)&buflen,
0) == -1)
if (tperrno != TPESVCFAIL)
LANZAR_EXCEPCION(CADENA_WHAT_SB,
"Error en funcion Execute(), llamada tpcall()",
tpstrerror(tperrno))
/* at this point: buf != a_buffer.getBuffer() */
tpcall() function change the memory address of buf. What is the problem? Is wrong my code? Is a problem with tuxedo version?
My tuxedo version is:
tmadmin -vINFO: BEA Tuxedo, Version 8.0, 32-bit, Patch Level 306
INFO: Serial #: 650522264137-773290431251, Expiration NONE, Maxusers 150
INFO: Licensed to: Telefonica Moviles Espa?a, S.A.
INFO: 56-bit Encryption Package
Thanks,
ANTONIO.There's nothing wrong with your code or tuxedo. tpcall (and tpgetrply) can change the address of the return buffer if it needs to allocate more memory to hold the data. This is the reason why you pass a pointer to the buffer as the output buffer parameter to tpcall and tpreturn. Everything is working as expected.
-
Problem in Exporting a Report Group having a Report Painter Report.
I am having a problem in exporting a Report group having a Report Painter report.When I am trying to export the Report Group using transaction GR57 with all dependent objects,it is displaying:
group 0102CPDNUEA-CCROSI not transported.
Transport groups separately if necessary.
There are 6 such groups which are not transported.Can anybody help me in this regards.Can anybody help me in exporting these Groups.Specifically in Report painter reports what do these Groups signify and how can we see them.Please help me....hi,
I am able to export my report groups with dependent objects successfully.
I dont know why you are getting error message. Just keep break point at ***** and execute it for single group and find out why it is giving error.
IF SY-BATCH = 'X' OR NO_LIST = 'X'. "direct or batch
SET PF-STATUS 'LIST'.
*****PERFORM TRANSPORT_OBJS USING 'X'. "transport all jobs
IF FILE_EXP <> 'X'.
READ TABLE WT_E071 INDEX 1.
IF SY-SUBRC = 0.
LEAVE.
ENDIF.
ENDIF.
ELSE. "online
SET PF-STATUS 'MENU'.
PERFORM WRITE_TRANSP_OBJS.
ENDIF.
regards,
ram -
Need help for SQL SELECT query to fetch XML records from Oracle tables having CLOB field
Hello,
I have a scenario wherein i need to fetch records from several oracle tables having CLOB fields(which is holding XML) and then merge them logically to form a hierarchy XML. All these tables are related with PK-FK relationship. This XML hierarchy is having 'OP' as top-most root node and ‘DE’ as it’s bottom-most node with One-To-Many relationship. Hence, Each OP can have multiple GM, Each GM can have multiple DM and so on.
Table structures are mentioned below:
OP:
Name Null Type
OP_NBR NOT NULL NUMBER(4) (Primary Key)
OP_DESC VARCHAR2(50)
OP_PAYLOD_XML CLOB
GM:
Name Null Type
GM_NBR NOT NULL NUMBER(4) (Primary Key)
GM_DESC VARCHAR2(40)
OP_NBR NOT NULL NUMBER(4) (Foreign Key)
GM_PAYLOD_XML CLOB
DM:
Name Null Type
DM_NBR NOT NULL NUMBER(4) (Primary Key)
DM_DESC VARCHAR2(40)
GM_NBR NOT NULL NUMBER(4) (Foreign Key)
DM_PAYLOD_XML CLOB
DE:
Name Null Type
DE_NBR NOT NULL NUMBER(4) (Primary Key)
DE_DESC NOT NULL VARCHAR2(40)
DM_NBR NOT NULL NUMBER(4) (Foreign Key)
DE_PAYLOD_XML CLOB
+++++++++++++++++++++++++++++++++++++++++++++++++++++
SELECT
j.op_nbr||'||'||j.op_desc||'||'||j.op_paylod_xml AS op_paylod_xml,
i.gm_nbr||'||'||i.gm_desc||'||'||i.gm_paylod_xml AS gm_paylod_xml,
h.dm_nbr||'||'||h.dm_desc||'||'||h.dm_paylod_xml AS dm_paylod_xml,
g.de_nbr||'||'||g.de_desc||'||'||g.de_paylod_xml AS de_paylod_xml,
FROM
DE g, DM h, GM i, OP j
WHERE
h.dm_nbr = g.dm_nbr(+) and
i.gm_nbr = h.gm_nbr(+) and
j.op_nbr = i.op_nbr(+)
+++++++++++++++++++++++++++++++++++++++++++++++++++++
I am using above SQL select statement for fetching the XML records and this gives me all related xmls for each entity in a single record(OP, GM, DM. DE). Output of this SQL query is as below:
Current O/P:
<resultSet>
<Record1>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<DM_PAYLOD_XML1>
<DE_PAYLOD_XML1>
</Record1>
<Record2>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML2>
<DM_PAYLOD_XML2>
<DE_PAYLOD_XML2>
</Record2>
<RecordN>
<OP_PAYLOD_XMLN>
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XMLN>
</RecordN>
</resultSet>
Now i want to change my SQL query so that i get following output structure:
<resultSet>
<Record>
<OP_PAYLOD_XML1>
<GM_PAYLOD_XML1>
<GM_PAYLOD_XML2> .......
<GM_PAYLOD_XMLN>
<DM_PAYLOD_XML1>
<DM_PAYLOD_XML2> .......
<DM_PAYLOD_XMLN>
<DE_PAYLOD_XML1>
<DE_PAYLOD_XML2> .......
<DE_PAYLOD_XMLN>
</Record>
<Record>
<OP_PAYLOD_XML2>
<GM_PAYLOD_XML1'>
<GM_PAYLOD_XML2'> .......
<GM_PAYLOD_XMLN'>
<DM_PAYLOD_XML1'>
<DM_PAYLOD_XML2'> .......
<DM_PAYLOD_XMLN'>
<DE_PAYLOD_XML1'>
<DE_PAYLOD_XML2'> .......
<DE_PAYLOD_XMLN'>
</Record>
<resultSet>
Appreciate your help in this regard!Hi,
A few questions :
How's your first query supposed to give you an XML output like you show ?
Is there something you're not telling us?
What's the content of, for example, <OP_PAYLOD_XML1> ?
I don't think it's a good idea to embed the node level in the tag name, it would make much sense to expose that as an attribute.
What's the db version BTW? -
has anyone ever had this problem? seems to be a problem in itunes, as i am having no problems downloading other files."There was a problem downloading “Outlander / Howard McCain”. An unknown error occurred (-50)."
kinda suck to pay for something you cant use!..Try fixing up the validation issues...
http://www.feedvalidator.org/check.cgi?url=http%3A%2F%2Fwww.stereogol.com%2Faudi o%2Fwimpy_podcast.php
Not promising it will help, but it's worth a shot. -
Hi all, i am new to this forum and i hope everyone is doing great.
I have a question on CLOB objects.
I am working on Oracle 8i and i have CLOB object coming from DB2 data base.
Can i apply Replace or Translate function on CLOB data? Because i have special characters like %$^@#. I want to replace all these.
Can anyone help me .
Thanks in Advance.Hi
This article uses DBMS_LOB to mimic the standard replace function for a CLOB. It's for 9i but it may be worth a try to see if it will work on 8i too.
http://www.astral-consultancy.co.uk/cgi-bin/hunbug/doco.cgi?11080
Hope this helps -
Im trying to update, but all it does is backup my phone, My itunes is updated, BTW, I just went to Apple bar, i had previous problem with prior phone, now im having this update problem with thyis new phone, someone HELP!!
Same here and this is driving me crazy. I can buy, but can't upgrade. Grrr.
Maybe you are looking for
-
I am wondering if Apple can help me in case my iPad was stolen?
Two weeks ago my iPad was stolen from my appartment. I try to block it using Find my iPhone service but it is useless because they switched off the geolocation service. I only got the message today that my iPad was eventually blocked but still do not
-
Hyperlinks won't work on some (my client's) machines but are fine on others
Hi All, I'm stuck on an infuriating problem and I'm really hoping someone here may be able to help. I've created a report for a client which includes several hyperlinks to URL's. These work perfectly on my PC, also on my MacBook (in both Acrobat and
-
Why won't my JList update?
My JList is first dimensioned to an array with 100 elements in it but then in a function i set it to null and then I set it to a different array with a smaller amount of elements. Then i call repaint() to refresh the pane but it still doesn't change
-
Uhh please Help me install packages =[ [SOLVED]
ok im running arch 2007, the newest, and im basically an arch n00b. I've been using linux for years, but never came across this error ....(while trying to install banshee, amarok,totem....) [anthony@Barton ~]$ sudo pacman -S totem warning: current lo
-
Is there a way to find text within Sequence?
Many of the TestStand 3.0 sequences that I'm creating are fairly lengthy (200 or more steps plus subsequences) and I often need to find a step within the sequence that has a specific string in the Step Name. I'm aware of the "Find" feature, but this