Property Finder have table as return type
Hi all
Is it possible to return the finders of vco table types?
If I give the property name in the property-bean attribute then it gives [Ljava.lang.String;@4981086 as value (as expected).
< bean-PROPERTY = display name "testProp" = "Property of Test" hidden = "false" name = "testProp" show in the column = see "real" description = "true" / >
But is it possible to specify bean-property attribute of tag finder so that we can wrap up the property value according to a static utility method. Maybe something like below (I know that the threshold is not correct, but it's just a wild guess)
< bean-property = "StringUtils.joinArray (testProp) property' display name ="Test well"hidden ="false"name ="testProp"show in the column = see"real"description ="true"/ >"
Or any other means by which I can manage property array return types.
Thank you for your help.
Best regards
Sumit Tyagi.
Hi Sergio,
Get it now, we can specify any OGNL expression in property accessor of property tag attribute. Read a little on the OGNL expressions and had it work.
The below xml tag property works for me now.
Best regards
Sumit Tyagi
Tags: VMware
Similar Questions
-
PLS-00630: pipeline functions must have a collection of supported return type
Hello, I created a TYPE of OBJECT and function PLSQL as shown below, but the function compile errors with that follows. Don't know where is the problem?
It's about Oracle 10 g r2PLS-00630: pipelined functions must have a supported collection return type
and here are the APICREATE OR REPLACE TYPE cxs_plsql_profiler_object_type AS OBJECT ( cxs_object_name VARCHAR2 (128), cxs_object_type VARCHAR2 (19), cxs_object_status VARCHAR2 (7), cxs_read_execution NUMBER, cxs_buffer_gets NUMBER, cxs_disk_reads NUMBER, cxs_executions NUMBER, cxs_sorts NUMBER, cxs_sharable_mem NUMBER, cxs_address NUMBER, cxs_hashvalue NUMBER, cxs_osuser VARCHAR2 (30), cxs_username VARCHAR2 (30), cxs_module VARCHAR2 (48), cxs_machine VARCHAR2 (64), cxs_status VARCHAR2 (8), cxs_terminal VARCHAR2 (16), cxs_percentconsume NUMBER, cxs_percentrepeat NUMBER, cxs_plan VARCHAR2 (120), target_name VARCHAR2 (200), referenced_name VARCHAR2 (200), referenced_type VARCHAR2 (200), targetowner VARCHAR2 (200), refowner VARCHAR2 (200) )
and here's tradtional types of tables that are used in the code above.FUNCTION CXS_GENERATE_PLSQL_PROFILER RETURN cxs_plsql_profiler_object_type PIPELINED IS out_rec cxs_plsql_profiler_object_type ; plsbatch plsql_batch; skount integer; dpendrec depend_tab; dkount integer; CURSOR objects IS SELECT object_name, object_type FROM dba_objects WHERE status = 'VALID' AND owner NOT IN ('SYS', 'SYSTEM') AND object_type IN ('PACKAGE', 'PROCEDURE', 'FUNCTION'); CURSOR apis (p_object dba_objects.object_name%TYPE) IS SELECT DISTINCT * FROM (SELECT SUBSTR (a.sql_text, 1, 50) sql_text, TRUNC ( a.disk_reads / DECODE (a.executions, 0, 1, a.executions ) ) reads_per_execution, a.buffer_gets, a.disk_reads, a.executions, a.sorts, a.sharable_mem, a.address, a.hash_value, b.osuser, b.username, b.module, b.machine, b.status, b.terminal, ROUND (cxs_db_info.kompute_percentofsql (a.sharable_mem), 5 ) percentkonsume, cxs_db_info.kount_repeat (b.osuser, b.terminal ) percentr, c.operation explainplan FROM v$sqlarea a, v$session b, v$sql_plan c WHERE b.sql_hash_value = a.hash_value AND b.sql_address = a.address AND a.hash_value = c.hash_value AND a.address = c.address AND b.status = 'ACTIVE' AND UPPER (a.sql_text) LIKE '%' || p_object || '%' AND c.ID = 0 ORDER BY 2 DESC) WHERE ROWNUM <= 50; --profile option BEGIN skount := 0; dkount := 0; FOR i IN objects LOOP FOR j IN apis (i.object_name) LOOP skount := skount + 1; plsbatch(skount).cxs_object_name := i.object_name; plsbatch(skount).cxs_object_type := i.object_type; plsbatch(skount).cxs_object_status := i.object_status; plsbatch(skount).cxs_read_execution := j.reads_per_execution; plsbatch(skount).cxs_buffer_gets := j.buffer_gets; plsbatch(skount).cxs_disk_reads := j.disk_reads; plsbatch(skount).cxs_executions := j.executions; plsbatch(skount).cxs_sorts := j.sorts; plsbatch(skount).cxs_sharable_mem := j.sharable_mem; plsbatch(skount).cxs_address := j.address; plsbatch(skount).cxs_hashvalue := j.hashvalue; plsbatch(skount).cxs_osuser := j.osuser; plsbatch(skount).cxs_username := j.username; plsbatch(skount).cxs_module := j.module; plsbatch(skount).cxs_machine := j.machine; plsbatch(skount).cxs_status := j.status; plsbatch(skount).cxs_terminal := j.terminal; plsbatch(skount).cxs_percentconsume := j.percentconsume; plsbatch(skount).cxs_percentrepeat := j.percentrepeat; plsbatch(skount).cxs_plan := j.explainplan; END LOOP; FOR dd IN dpend (i.object_name) LOOP dkount := dkount + 1; dependrec (dkount).target_name := dd.NAME; dependrec (dkount).refname := dd.referenced_name; dependrec (dkount).reftype := dd.referenced_type; dependrec (dkount).target_owner := dd.owner; dependrec (dkount).refowner := dd.referenced_owner; END LOOP; END LOOP; for a in 1..skount loop out_rec.cxs_object_type := plsbatch(a).object_type; out_rec.cxs_object_status := plsbatch(a).object_status; out_rec.cxs_read_execution := plsbatch(a).reads_per_execution; out_rec.cxs_buffer_gets := plsbatch(a).buffer_gets; out_rec.cxs_disk_reads := plsbatch(a).disk_reads; out_rec.cxs_executions := plsbatch(a).executions; out_rec.cxs_sorts := plsbatch(a).sorts; out_rec.cxs_sharable_mem := plsbatch(a).sharable_mem; out_rec.cxs_address := plsbatch(a).address; out_rec.cxs_hashvalue := plsbatch(a).hashvalue; out_rec.cxs_osuser := plsbatch(a).osuser; out_rec.cxs_username := plsbatch(a).username; out_rec.cxs_module := plsbatch(a).module; out_rec.cxs_machine := plsbatch(a).machine; out_rec.cxs_status := plsbatch(a).status; out_rec.cxs_terminal := plsbatch(a).terminal; out_rec.cxs_percentconsume := plsbatch(a).percentconsume; out_rec.cxs_percentrepeat := plsbatch(a).percentrepeat; out_rec.cxs_plan := plsbatch(a).explainplan; PIPE ROW(out_rec); end loop; for b in 1..dkount loop out_rec.target_name := dd.NAME; out_rec.refname := dependrec (b).referenced_name; out_rec.reftype := dependrec (b).referenced_type; out_rec.target_owner := dependrec (b).owner; out_rec.refowner := dependrec (b).referenced_owner; PIPE ROW(out_rec); end loop; RETURN; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.format_error_backtrace); DBMS_OUTPUT.PUT_LINE(SQLCODE); DBMS_OUTPUT.PUT_LINE(SQLERRM); END;
Thank you for your time in reading this postTYPE type_plsql_rec IS RECORD ( cxs_object_name VARCHAR2 (128), cxs_object_type VARCHAR2 (19), cxs_object_status VARCHAR2 (7), cxs_read_execution NUMBER, cxs_buffer_gets NUMBER, cxs_disk_reads NUMBER, cxs_executions NUMBER, cxs_sorts NUMBER, cxs_sharable_mem NUMBER, cxs_address NUMBER, cxs_hashvalue NUMBER, cxs_osuser VARCHAR2 (30), cxs_username VARCHAR2 (30), cxs_module VARCHAR2 (48), cxs_machine VARCHAR2 (64), cxs_status VARCHAR2 (8), cxs_terminal VARCHAR2 (16), cxs_percentconsume NUMBER, cxs_percentrepeat NUMBER, cxs_plan VARCHAR2 (120) ); TYPE plsql_batch IS TABLE OF type_plsql_rec INDEX BY BINARY_INTEGER; TYPE type_depend_tab IS RECORD ( target_name dba_dependencies.NAME%TYPE, refname dba_dependencies.referenced_name%TYPE, reftype dba_dependencies.referenced_type%TYPE, target_owner dba_dependencies.owner%TYPE, refowner dba_dependencies.referenced_owner%TYPE ); TYPE depend_tab IS TABLE OF type_depend_tab INDEX BY BINARY_INTEGER;
RJohan says:
Sorry!.
Actually, I meant
I thought as well.
Typos can be expensive however. As a probe of NASA Mars in 99, which was lost due to a simple mathematical error - a confusion between English and metric units. ;-)
Or screw up a server in reason to use a Unix fork() where the client process think that it is the parent and the beginning more children who believe they are also parents of spawning... (one of my mistakes of kewlest never) :-)
-
Hello
I read conflicting information about the return type that has a table function must or may use.
First, I am a student of a book that says:
Function in pipeline returns the data types:
The main constraint for the pipeline functions, it is the return type must be a collection type autonomous which can be used in SQL - i.e. a VARRAY or table nested.
and then in the next sentence...
More precisely a pipeline function can return the following:
A stand-alone nested table or VARRAY, defined at the schema level.
A nested table or VARRAY that has been declared in a package type.
This seems to go against the first quoted sentence.
Now, before reading the above text I had done just my own test to see if a packed type would work because I thought I had read somewhere that it would not, and he does not (the test code and this output is at the end of this question). When I arrived in the text above, after my test, so I was naturally confused.
So, I'm going to PL/SQL reference that says:
RETURN data type
The data type of the value returned by a function table in pipeline must be a type collection defined either at the level of schema or within a package (therefore, it cannot be a type of associative array).
I tried to call a function that returns a collection of VARRAY type packaged in both SQL and PL/SQL (of course below is SQL all in any case) and no work.
Now I'm wondering what is a TABLE function must use a schema type and a function table in pipeline can use a packaged type? I see that I created and called a function table but examples of Oracle see the creation and use of a function table in pipeline.
Edit: I should add that I read the following sentence in the SF book on p609 in * table functions: "this type of nested table must be defined as an element of level diagram, because the SQL engine must be able to resolve a reference to a collection of this kind."
So that it begins to resemble table functions should return a schema type and pipelined table functions, perhaps because that they don't in fact return a collection, rather they return (RowSource) content, can use the schema types or types of packages. Is this correct?
Can someone clarify this for me please?
Thank you in advance,
J
CREATE OR REPLACE PACKAGE PKGP28M
VAT-type is varray (5) number;
END;
/
DISPLAY ERRORS
create or replace type VAT is varray (5) number;
/
display errors
create or replace function tabfunc1 return pkgp28m.vat as
numtab pkgp28m.vat:=pkgp28m.vat();
Start
numtab.extend (5);
because loop me in 1.5
numtab (i): = trunc (dbms_random. Value (1.5));
end loop;
Return numtab;
end;
/
display errors
create or replace function tabfunc2 as return VAT
numtab vat:=vat().
Start
numtab.extend (5);
because loop me in 1.5
numtab (i): = trunc (dbms_random. Value (1.5));
end loop;
Return numtab;
end;
/
display errors
exec dbms_output.put_line (' call tabfunc1 (returns the packaged type) :');)
Select * from table (tabfunc1)
/
exec dbms_output.put_line (' call tabfunc2 (returns the type of schema) :');)
Select * from table (tabfunc2)
/
declare
RC sys_refcursor;
number of v;
Start
dbms_output.put_line (' in anonymous block1 - open rc to select in the table (tabfunc1) (returns the packaged type) :');)
Open rc to select table column_value (tabfunc1);
loop
extract the rc in v;
When the output rc % notfound;
dbms_output.put_line (' > ' | to_char (v));
end loop;
close the rc;
end;
/
declare
RC sys_refcursor;
number of v;
Start
dbms_output.put_line (' in anonymous block2 - open rc to select in the table (tabfunc2) (returns the type of schema) :');)
Open rc to select table column_value (tabfunc2);
loop
extract the rc in v;
When the output rc % notfound;
dbms_output.put_line (' > ' | to_char (v));
end loop;
close the rc;
end;
/
Scott@ORCL > @C:\Users\J\Documents\SQL\test29.sql
Package created.
No errors.
Type of creation.
No errors.
The function is created.
No errors.
The function is created.
No errors.
the call of tabfunc1 (returns the packaged type):
PL/SQL procedure successfully completed.
Select * from table (tabfunc1)
*
ERROR on line 1:
ORA-00902: invalid data type
the call of tabfunc2 (returns the type of schema):
PL/SQL procedure successfully completed.
COLUMN_VALUE
------------
1
4
1
1
3
In anonymous block1 - open rc to select in the table (tabfunc1) (returns the packaged type):
declare
*
ERROR on line 1:
ORA-00902: invalid data type
ORA-06512: at line 6
In anonymous block2 - open rc to select in the table (tabfunc2) (returns the type of schema):
> 1
> 2
> 4
> 2
> 3
PL/SQL procedure successfully completed.
Post edited by: Jason_942375
But the compilation of the PIPELINED WILL CREATE the schematic function types automatically. And the TABLE function, applied to the PIPELINED function, use these types of hidden patterns.
-
Nested table of object type have only one record all the time
Hi all
I have a question regarding the storage of multiple records in a nested Table that is of type OBJECT.
The program below that I wrote for the test and during the test, I was able to store only the last record in the nested Table.
Please let me know what I did wrong here.
Step 1:
CREATE or REPLACE TYPE book_obj AS OBJECT (name varchar2 (25), author varchar2 (25), abstract varchar2 (4000));
/
Step 2:
CREATE or REPLACE TYPE book_table IS TABLE OF THE book_obj;
/
Step 3: CREATE TABLE book (name, varchar2 (25), varchar2 (25) author, varchar2 (4000)) abstract;
INSERT VALUES Accountants ('Harry Potter,' 'MK', 'It's magic');
INSERT the book VALUES ("Ramayana', 'VK', 'It is mythiology'");
COMMIT;
Step 4:
declare
bookset book_table;
ln_cnt pls_integer;
Start
bookset: = book_table (book_obj ('madhu', 'kongara', 'sudhan'));
dbms_output.put_line (' the number is ' | bookset.) (Count); -> I see COUNT = 1
bookset: = bookset_t(); -> Assignment to NULL.
dbms_output.put_line (' the number is ' | bookset.) (Count); -> I see County 0
for rec in (select * from book) loop-> now a loop twice.
dbms_output.put_line (' name > ' |) Rec.Name);
bookset: = bookset_t (book_t (rec.name, rec.author, rec.abstract));
end loop;
dbms_output.put_line (' the number is ' | bookset.) (Count); -> I can see COUNT = 1 (why?)
END;
I looped twice to fill two records in the TABLE IMBRIQUEE OF TYPE OBJECT. But when I see the Count I get only 1 and the data is also having the last record.
Can you get it someone please let me know how to fill out the table nested with all records. Tell me where I am wrong.
Very much appreciate your help here.
Thank you and best regards,
NKMMaldini says:
dbms_output.put_line (' the number is ' | bookset.) (Count); -->, I can see COUNT = 1 (why?)Because instead of add to bookset collectionto set (ergo replacement) it a collection containing recovered book. Use:
declare bookset book_table; ln_cnt pls_integer; begin bookset := book_table(book_obj('madhu','kongara','sudhan')); dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 bookset := book_table(); --> Assigning back to NULL. dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0 for rec in (select * from book) loop --> Now Looping two times. dbms_output.put_line(' name > '||rec.name); bookset.extend; bookset(bookset.count) := book_obj(rec.name, rec.author, rec.abstract); end loop; dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why) end; / The count is 1 The count is 0 name > Harry Potter name > Ramayana The count is 2 PL/SQL procedure successfully completed. SQL>
Or better use bulk collect:
declare bookset book_table; ln_cnt pls_integer; begin bookset := book_table(book_obj('madhu','kongara','sudhan')); dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 bookset := book_table(); --> Assigning back to NULL. dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0 select book_obj(name,author,abstract) bulk collect into bookset from book; for i in 1..bookset.count loop --> Now Looping two times. dbms_output.put_line(' name > '||bookset(i).name); end loop; dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why) end; / The count is 1 The count is 0 name > Harry Potter name > Ramayana The count is 2 PL/SQL procedure successfully completed. SQL>
SY.
-
Find all tables that have not at least a DATE column
DB version: 10 gr 2
View user_tab_cols using, how can I find the tables that have not at least a column of DATE(user_tab_cols.data_Type='DATE')?SELECT table_name FROM user_tables WHERE table_name NOT IN ( SELECT DISTINCT table_name FROM user_tab_cols WHERE DATA_TYPE = 'DATE' );
Concerning
Arun -
How to find the table in a schema, if I only have a particular column name
Hi all
Ideal if some1 could help me, I know not a column name and I need to find the table that actually holds this column paricular name I know.
is it possible to find this particular table with SQL?
Thank you
RahulSelect the table TABLE_NAME from user_tab_columns where column_name = 'COLUMN_NAME '.
-
How to get a magic number for any table that returns more than 32 k?
I'm in a unique situation where in I try to extract the values of the multiple tables and to publish as XML output. The problem is based on the condition of a few tables can retrieve more than 32 KB and less than 32 KB of data. Less than 32KB is not a problem, as the generation of XML is smooth. The minute he reached more than 32 k, it generates a runtime error. I was wondering if there is a way to make sure that the minute results of the query is greater than 32 KB, it must break say - if results is 35KO, so should I break this result 32 KB and 3 KB. Once then pass these data to appear as XML output. Again, it is not just for a table, but all the tables which are called in the function.
Is it possible? I'm unable to get ideas, or did I do something so complex from the point of view of production support. If you'd be grateful if someone can guide me on this.
The way it is, is the following:
I have a table named ctn_pub_cntlCREATE TABLE CTNAPP.ctn_pub_cntl (ctn_pub_cntl_id NUMBER(18) ,table_name VARCHAR2(50) ,last_pub_tms DATE ,queue_name VARCHAR2(50) ,dest_system VARCHAR2(50) ,frequency NUMBER(6) ,status VARCHAR2(8) ,record_create_tms DATE ,create_user_id VARCHAR2(8) ,record_update_tms DATE ,update_user_id VARCHAR2(8) ,CONSTRAINT ctn_pub_cntl_id_pk PRIMARY KEY(ctn_pub_cntl_id) );
To do this, the data are:
INSERT INTO CTNAPP.ctn_pub_cntl (ctn_pub_cntl_id ,table_name ,last_pub_tms ,queue_name ,dest_system ,frequency ) VALUES (CTNAPP_SQNC.nextval ,'TRKFCG_SBDVSN' ,TO_DATE('10/2/2004 10:17:44PM','MM/DD/YYYY HH12:MI:SSPM') ,'UT.TSD.TSZ601.UNP' ,'SAP' ,15 ); INSERT INTO CTNAPP.ctn_pub_cntl (ctn_pub_cntl_id ,table_name ,last_pub_tms ,queue_name ,dest_system ,frequency ) VALUES (CTNAPP_SQNC.nextval ,'TRKFCG_TRACK_SGMNT_DN' ,TO_DATE('02/06/2015 9:50:00AM','MM/DD/YYYY HH12:MI:SSPM') ,'UT.TSD.WRKORD.UNP' ,'SAP' ,30 ); INSERT INTO CTNAPP.ctn_pub_cntl (ctn_pub_cntl_id ,table_name ,last_pub_tms ,queue_name ,dest_system ,frequency ) VALUES (CTNAPP_SQNC.nextval ,'TRKFCG_FXPLA_TRACK_LCTN_DN' ,TO_DATE('10/2/2004 10:17:44PM','MM/DD/YYYY HH12:MI:SSPM') ,'UT.TSD.YRDPLN.INPUT' ,'SAP' ,30 ); INSERT INTO CTNAPP.ctn_pub_cntl (ctn_pub_cntl_id ,table_name ,last_pub_tms ,queue_name ,dest_system ,frequency ) VALUES (CTNAPP_SQNC.nextval ,'TRKFCG_FXPLA_TRACK_LCTN2_DN' ,TO_DATE('02/06/2015 9:50:00AM','MM/DD/YYYY HH12:MI:SSPM') ,'UT.TSD.TSZ601.UNP' ,'SAP' ,120 ); INSERT INTO CTNAPP.ctn_pub_cntl (ctn_pub_cntl_id ,table_name ,last_pub_tms ,queue_name ,dest_system ,frequency ) VALUES (CTNAPP_SQNC.nextval ,'TRKFCG_FXPLA_TRACK_LCTN2_DN' ,TO_DATE('04/23/2015 11:50:00PM','MM/DD/YYYY HH12:MI:SSPM') ,'UT.TSD.YRDPLN.INPUT' ,'SAP' ,10 ); INSERT INTO CTNAPP.ctn_pub_cntl (ctn_pub_cntl_id ,table_name ,last_pub_tms ,queue_name ,dest_system ,frequency ) VALUES (CTNAPP_SQNC.nextval ,'TRKFCG_FIXED_PLANT_ASSET' ,TO_DATE('04/23/2015 11:50:00AM','MM/DD/YYYY HH12:MI:SSPM') ,'UT.TSD.WRKORD.UNP' ,'SAP' ,10 ); INSERT INTO CTNAPP.ctn_pub_cntl (ctn_pub_cntl_id ,table_name ,last_pub_tms ,queue_name ,dest_system ,frequency ) VALUES (CTNAPP_SQNC.nextval ,'TRKFCG_OPRLMT' ,TO_DATE('03/26/2015 7:50:00AM','MM/DD/YYYY HH12:MI:SSPM') ,'UT.TSD.WRKORD.UNP' ,'SAP' ,30 ); INSERT INTO CTNAPP.ctn_pub_cntl (ctn_pub_cntl_id ,table_name ,last_pub_tms ,queue_name ,dest_system ,frequency ) VALUES (CTNAPP_SQNC.nextval ,'TRKFCG_OPRLMT_SGMNT_DN' ,TO_DATE('03/28/2015 12:50:00AM','MM/DD/YYYY HH12:MI:SSPM') ,'UT.TSD.WRKORD.UNP' ,'SAP' ,30 ); / COMMIT;
Once the above data are inserted and committed, then I created a feature in a package:
CREATE OR REPLACE PACKAGE CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH IS TYPE tNameTyp IS TABLE OF ctn_pub_cntl.table_name%TYPE INDEX BY BINARY_INTEGER; g_tName tNameTyp; TYPE tClobTyp IS TABLE OF CLOB INDEX BY BINARY_INTEGER; g_tClob tClobTyp; FUNCTION GetCtnData(p_nInCtnPubCntlID IN CTN_PUB_CNTL.ctn_pub_cntl_id%TYPE,p_count OUT NUMBER ) RETURN tClobTyp; END CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH; --Package body CREATE OR REPLACE PACKAGE BODY CTNAPP.CTN_PUB_CNTL_EXTRACT_PUBLISH IS doc xmldom.DOMDocument; main_node xmldom.DOMNode; root_node xmldom.DOMNode; root_elmt xmldom.DOMElement; child_node xmldom.DOMNode; child_elmt xmldom.DOMElement; leaf_node xmldom.DOMNode; elmt_value xmldom.DOMText; tbl_node xmldom.DOMNode; table_data XMLDOM.DOMDOCUMENTFRAGMENT; l_ctx DBMS_XMLGEN.CTXHANDLE; vStrSqlQuery VARCHAR2(32767); l_clob tClobTyp; -- l_xmltype XMLTYPE; -- --Local Procedure to build XML header PROCEDURE BuildCPRHeader IS BEGIN child_elmt := xmldom.createElement(doc, 'PUBLISH_HEADER'); child_node := xmldom.appendChild (root_node, xmldom.makeNode (child_elmt)); child_elmt := xmldom.createElement (doc, 'SOURCE_APLCTN_ID'); elmt_value := xmldom.createTextNode (doc, 'CTN'); leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt)); leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value)); child_elmt := xmldom.createElement (doc, 'SOURCE_PRGRM_ID'); elmt_value := xmldom.createTextNode (doc, 'VALUE'); leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt)); leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value)); child_elmt := xmldom.createElement (doc, 'SOURCE_CMPNT_ID'); elmt_value := xmldom.createTextNode (doc, 'VALUE'); leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt)); leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value)); child_elmt := xmldom.createElement (doc, 'PUBLISH_TMS'); elmt_value := xmldom.createTextNode (doc, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI:SS')); leaf_node := xmldom.appendChild (child_node, xmldom.makeNode (child_elmt)); leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value)); END BuildCPRHeader; --Get table data based on table name FUNCTION GetCtnData(p_nInCtnPubCntlID IN CTN_PUB_CNTL.ctn_pub_cntl_id%TYPE,p_Count OUT NUMBER) RETURN tClobTyp IS vTblName ctn_pub_cntl.table_name%TYPE; vLastPubTms ctn_pub_cntl.last_pub_tms%TYPE; BEGIN g_vProcedureName:='GetCtnData'; g_vTableName:='CTN_PUB_CNTL'; SELECT table_name,last_pub_tms INTO vTblName, vLastPubTms FROM CTN_PUB_CNTL WHERE ctn_pub_cntl_id=p_nInCtnPubCntlID; -- Start the XML Message generation doc := xmldom.newDOMDocument; main_node := xmldom.makeNode(doc); root_elmt := xmldom.createElement(doc, 'PUBLISH'); root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt)); --Append Table Data as Publish Header BuildCPRHeader; --Append Table Data as Publish Body child_elmt := xmldom.createElement(doc, 'PUBLISH_BODY'); leaf_node := xmldom.appendChild (root_node, xmldom.makeNode(child_elmt)); DBMS_SESSION.SET_NLS('NLS_DATE_FORMAT','''YYYY:MM:DD HH24:MI:SS'''); vStrSqlQuery := 'SELECT * FROM ' || vTblName || ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ; -- || ' AND rownum < 16' --; DBMS_OUTPUT.PUT_LINE(vStrSqlQuery); l_ctx := DBMS_XMLGEN.NEWCONTEXT(vStrSqlQuery); DBMS_XMLGEN.SETNULLHANDLING(l_ctx, 0); DBMS_XMLGEN.SETROWSETTAG(l_ctx, vTblName); -- Append Table Data as XML Fragment l_clob(1):=DBMS_XMLGEN.GETXML(l_ctx); elmt_value := xmldom.createTextNode (doc, l_clob(1)); leaf_node := xmldom.appendChild (leaf_node, xmldom.makeNode (elmt_value)); xmldom.writeToBuffer (doc, l_clob(1)); l_clob(1):=REPLACE(l_clob(1),'<?xml version="1.0"?>', NULL); l_clob(1):=REPLACE(l_clob(1),'<', '<'); l_clob(1):=REPLACE(l_clob(1),'>', '>'); RETURN l_clob; DBMS_OUTPUT.put_line('Answer is' ||l_clob(1)); EXCEPTION WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.put_line('There is no data with' || SQLERRM); g_vProcedureName:='GetCtnData'; g_vTableName:='CTN_PUB_CNTL'; g_vErrorMessage:=SQLERRM|| g_vErrorMessage; g_nSqlCd:=SQLCODE; ctn_log_error('ERROR',g_vErrorMessage,'SELECT',g_nSqlCd,p_nInCtnPubCntlID,g_vPackageName,g_vProcedureName,g_vTableName); WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE('ERROR : ' || SQLERRM); ctn_log_error('ERROR',g_vErrorMessage,'OTHERS',g_nSqlCd,p_nInCtnPubCntlID,g_vPackageName,g_vProcedureName,g_vTableName); END GetCtnData; PROCEDURE printClob (result IN OUT NOCOPY CLOB) IS xmlstr VARCHAR2 (32767); line VARCHAR2 (2000); BEGIN xmlstr := DBMS_LOB.SUBSTR (result, 32767); LOOP EXIT WHEN xmlstr IS NULL; line := SUBSTR (xmlstr, 1, INSTR (xmlstr, CHR (10)) - 1); DBMS_OUTPUT.put_line (line); xmlstr := SUBSTR (xmlstr, INSTR (xmlstr, CHR (10)) + 1); END LOOP; END printClob; END CTN_PUB_CNTL_EXTRACT_PUBLISH;
If you notice my query:
vStrSqlQuery := 'SELECT * FROM ' || vTblName || ' WHERE record_update_tms <= TO_DATE(''' || TO_CHAR(vLastPubTms, 'MM/DD/YYYY HH24:MI:SS') || ''', ''MM/DD/YYYY HH24:MI:SS'') ' ; || ' AND rownum < 16' ;
The minute I comment
|| ' AND rownum < 16' ;
It generates an error because this query returns about 600 lines and all these lines must be published in XML format and the tragedy, is that it is a C program between institutions i.e. C calls my functions of packged and then will do all the processing. This will return the results to the C program. Then obviously C does not recognize the CLOB and somewhere in the process, I convert to VARCHAR or CLOB CLOB, I have to use VARCHAR as a return type. That's my challenge.
Someone who can help me find the number required of magic and also a brief knows how, I understand that. Thanks in advance.
Not that I would use it myself but your package can be simplified down, like this:
create or replace package ctn_pub_cntl_extract_publish is C_DTFORMAT constant varchar2(30) := 'YYYY-MM-DD HH24:MI:SS'; function getXMLData (p_table_name in varchar2, p_pub_tms in date) return xmltype; function getCTNData (p_id in number) return clob; end ctn_pub_cntl_extract_publish; / create or replace package body ctn_pub_cntl_extract_publish is function getXMLData (p_table_name in varchar2, p_pub_tms in date) return xmltype is v_query varchar2(32767) := q'{select * from $$TABLE_NAME where record_update_tms <= to_date(:1, 'YYYYMMDDHH24MISS')}'; ctx dbms_xmlgen.ctxHandle; doc xmltype; begin execute immediate 'alter session set nls_date_format = "'||C_DTFORMAT||'"'; v_query := replace(v_query, '$$TABLE_NAME', dbms_assert.simple_sql_name(p_table_name)); ctx := dbms_xmlgen.newContext(v_query); dbms_xmlgen.setBindValue(ctx, '1', to_char(p_pub_tms, 'YYYYMMDDHH24MISS')); dbms_xmlgen.setRowSetTag(ctx, p_table_name); dbms_xmlgen.setNullHandling(ctx, dbms_xmlgen.DROP_NULLS); doc := dbms_xmlgen.getXMLType(ctx); dbms_xmlgen.closeContext(ctx); return doc; end; function getCTNData (p_id in number) return clob is doc clob; begin select xmlserialize(document xmlelement("PUBLISH" , xmlelement("PUBLISH_HEADER" , xmlforest( 'CNT' as "SOURCE_APLCTN_ID" , 'VALUE' as "SOURCE_PRGRM_ID" , 'VALUE' as "SOURCE_CMPNT_ID" , to_char(sysdate, C_DTFORMAT) as "PUBLISH_TMS" ) ) , xmlelement("PUBLISH_BODY" , getXMLData(t.table_name, t.last_pub_tms) ) ) ) into doc from ctn_pub_cntl t where t.ctn_pub_cntl_id = p_id; return doc; end; end ctn_pub_cntl_extract_publish;
Function getXMLData() generates a canonical XML document out of the table that is passed as a parameter.
Function built getCTNData() code XML "PUBLISH", the document using SQL/XML functions, the getXMLData() call in the process and returns the content serialized as a CLOB.
-
DatabaseProcedure with the return type preceded of the schema name
Salvation (Paco)
I have a question on the DatabaseProcedure class. We use proxy Oracle users to our database connections.
Everything is accessible via a role of database that are granted to the user. All of our database objects, tables, etc. are protected by this database role.
When I want to call a function/procedure of database, I need to add the name of the schema as a prefix to the custom database object that uses us for parameters and return types.
So far so good. I can also define a parameter prefixed by the name of schema via the DatabaseProcedure.registerArrayType...
But when I try to set a function call that uses this parameter I get an error saying "the statement is not valid.
The problem is the regular pattern of PROCEDURE_DEFINITION:
The return type cannot be prefixed by the name of schema.private static final Pattern PROCEDURE_DEFINITION = Pattern.compile("\\s* (FUNCTION|PROCEDURE) \\s+ ([\\w.$]+) \\s* (?:\\((.*?)\\))? \\s* (?:RETURN\\s+(\\w+))? \\s* ;? \\s*", CASE_INSENSITIVE | COMMENTS | DOTALL);
Any good suggestions or workarounds?
I have actually change the duration of reflection model to make it work-, but I really don't like this solution over the long term.
/ Torben
Published by: Zonic 2013-05-07 10:52Hi Torben,
I think that I have a work around for the problem which might work for you. If you look at the source of DatabaseProcedure.registerArrayType you will find that it is actually called DatabaseProcedure.registerCustomParamType.
public static void registerArrayType(String name) { registerCustomParamType(name, Types.ARRAY, Array.getORADataFactory(), name); }
A solution you can replace calls to DatabaseProcedure.registerArrayType with calls to DatabaseProcedure.registerCustomParamType as follows.
// Instead of DatabaseProcedure.registerArrayType("NAME.WITH.DOTS") call: DatabaseProcedure.registerCustomParamType("anyNameWithoutDots", Types.ARRAY, Array.getORADataFactory(), "NAME.WITH.DOTS"); // Don't forget to use uppercase here. DatabaseProcedure dp = DatabaseProcedure.define("procedure my.procedure(param1 in out anyNameWithoutDots)"); DatabaseProcedure.ParamType type = dp.getParamDef(0).getType(); System.out.println(type.getName() + " is " + type.getTypeName()); // ANYNAMEWITHOUTDOTS is NAME.WITH.DOTS
In this way, that you don't have to use the 'illegal' name in the definition of DatabaseProcedure.
Kind regards
Paco van der Linden -
Return type of dataframe string identifier
Hello
If I have to return a dataframe of rqScript which contains the string, how am I suppose to mention it in the return type of rqTableEval.
For example, if the return value of rqScript isdata.frame (c (1), c("Name"))
, which is a number and the other string
Then in the rqTableEval, identify the return values
'select ID, 1 '1' chain of double'
1 works as an identifier for the numbers but '1' doesn't work, '1' as an invalid identifier for the return string
I tried with the host of permutations "-* ','. '. "\ *", "a" etc., none seems not to work
Can I please get help on which must be specified as an identifier for the string type?
Published by: Kedar Gupte on May 21, 2013 01:52Kedar,
The string must be long enough to accommodate the output. For example, for a maximum length of 10 characters, you can do "Lucy" or cast ('a' as varchar2 (10)). You must also use single quotes instead of double quotes. In SQL double quotes are used to specify the identifiers (such as table names, column names, etc.). In your example, '1' is an unknown identifier. What you need is a string literal.
Denis
-
Hello
Simply create database SQLite Database Browser 2.0 B1 after creating the database, when I tried to connect in flash cs4 - with air 1.1 his error show me
SQLError: ' error #3115: SQL Error.', details:' no table of this type: "contact", operation: 'run', detailID: "2013" I tried to find anywhere but does not have the solution to this "
my code is here
import flash.filesystem.File;
flash.data import. *;
import flash.data.SQLConnection;
import flash.data.SQLStatement;
import flash.data.SQLConnection;
var dbFile:File is File.applicationStorageDirectory.resol vePath ("mydb.db");.
var sqlConn:SQLConnection = new SqlConnection ();
var sqlState:SQLStatement = new SQLStatement();
sqlConn.open (dbFile);
sqlState.sqlConnection = sqlConn;
trace (status sqlConn.connected + "current"); his show 'true' here
sqlState.text = "SELECT name FROM contact."
sqlState.execute ();
var resultArray:Array = sqlState.getResult () .data;
Thanks in advanceHello
I create my Adobe Air App using Flash Professional CS5 and faced with exactly the same error.
SQLError: ' #3115 error: SQL Error. ", details:' no table of this type:"categories", operation: 'run', detailID:"2013"
My SQLite Db was created using Firefox SQLite Manager - extension. The db file is placed in the same folder as the .fla and .swf files. The db has three tables namely: duration and activity categories. I don't understand why I get this error. I even tried to copy paste any other source code of the AS 3.0 but same error reference guide each time.
The code below is a modified version of the code example in the documentation for reference AS 3.0. Can you suggest how the error above can be fixed?
/ You can also respond to me directly at [email protected]
/regards
import flash.data.SQLConnection;
import flash.data.SQLResult;
import flash.data.SQLStatement;
import flash.display.Sprite;
import flash.events.SQLErrorEvent;
import flash.events.SQLEvent;
import flash.filesystem.File;
var conn: SQLConnection;
var insertCategory:SQLStatement;
var dbFile:File;
//*************************************
databaseConnect();
//*************************************
function databaseConnect (): void
{
define where the database file is located
var appStorage:File = File.applicationStorageDirectory;
dbFile = appStorage.resolvePath ("MyBudgetCalc.db");
Open the database connection
Conn = new SqlConnection ();
conn.addEventListener (SQLErrorEvent.ERROR, errorHandler);
conn.addEventListener (SQLEvent.OPEN, openHandler);
trace ("dbFile.exists:" + dbFile.exists);
conn.openAsync (dbFile);
}
Called when the database is connected
function openHandler(event:SQLEvent):void
{
conn.removeEventListener (SQLEvent.OPEN, openHandler);
starts a transaction
Object (this).inputfield.text = "openHandler called..";
conn.addEventListener (beginHandler, SQLEvent.BEGIN);
Conn.Begin ();
trace ("openHandler sweetness...");
}
Called when the transaction begins
function beginHandler(event:SQLEvent):void
{
conn.removeEventListener (beginHandler, SQLEvent.BEGIN);
trace ("beginHandler - SQLEvent message:" + SQLEvent.message);
Object (this).inputfield.text = "called beginHandler..";
insertCategory = new SQLStatement();
insertCategory.sqlConnection = conn;
insertCategory.text = "INSERT INTO categories (id, name) VALUES (', Auto')";
insertCategory.execute ();
insertCategory.addEventListener (SQLEvent.RESULT, insertCategoryHandler);
insertCategory.addEventListener (SQLErrorEvent.ERROR, errorHandler);
trace ("sweetness beginHandler..");
}
Called after the record of phone number is inserted
function insertCategoryHandler(event:SQLEvent):void
{
insertCategory.removeEventListener (SQLEvent.RESULT, insertCategoryHandler);
insertCategory.removeEventListener (SQLErrorEvent.ERROR, errorHandler);
No errors so far, so commit the transaction
conn.addEventListener (SQLEvent.COMMIT, commitHandler);
Conn.Commit ();
trace ("outgoing insertCategoryHandler after conn.commit ()...");
}
Called after the transaction validation
function commitHandler(event:SQLEvent):void
{
conn.removeEventListener (SQLEvent.COMMIT, commitHandler);
trace ("commitHandler() output: all Transaction...");
}
Called whenever an error occurs
function errorHandler(event:SQLErrorEvent):void
{
trace ("seizure of errorHandler ()..");
If a transaction goes, roll back
If (conn.inTransaction)
{
conn.addEventListener (SQLEvent.ROLLBACK, rollbackHandler);
Conn.Rollback ();
}
trace (Event.Error.message);
trace (Event.Error.Details);
trace ("sweetness errorHandler()..");
}
Called when the transaction is rolled back
function rollbackHandler(event:SQLEvent):void
{
conn.removeEventListener (SQLEvent.ROLLBACK, rollbackHandler);
}
-
Doubt about the return type of function
Hello
Can a function returns a Boolean value in a select query.
Suppose m creating a function... so can we have a return type of Boolean as...?
If so... THN please give an exampleCan a function returns a Boolean value in a select query
The answer is no. a Boolean is not a SQL data type and may not be used in the SELECT query.
For the user-defined function to be called in a SQL statement, see http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_packages.htm#ADFNS00908
Note especially these lines"Its formal parameters and its return value (if any) must have built-in data types (for example, CHAR, DATE or NUMBER) Oracle, not types (such as BOOLEAN, RECORD or TABLE) PL/SQL data.
"There is an exception to this rule: a formal parameter can have a PL/SQL data type, if the corresponding actual parameter is implicitly converted to the data type of the formal parameter" >
Published by: Johan August 3, 2010 03:48
-
I can't find any information about the type of server type server incoming or outgoing so that I can set up an e-mail account to windows on the yahoo site.
Here are instructions to configure Yahoo in Windows Mail in Vista: http://www.freeemailtutorials.com/vistaWindowsMail/setupYahooMailInWindowsMail.php. It includes the server settings you requested. I don't know if they are the same with other e-mail programs, but that's what comes with Vista and you're in a Forum of Vista so I took my best shot at the choice of this particular option to present.
There are many other tutorials and articles on how to set up the account depending on what e-mail program you are using and what type of Yahoo email account you have. Go to http://search.yahoo.com/search;_ylt=Amc3Rw9f2u0uuHTa9.YBe0SbvZx4?fr=yfp-t-701-s&toggle=1&cop=mss&ei=UTF8&p=yahoo%20email%20settings%20for%20windows%20mail and enter your question as "for Windows Live Mail, the e-mail settings" or "for Outlook 2007, the settings of e-mail"or what you use.» Check the results, and then search for tutorials on the option that you use. Again, whether or not you can do depends on the type of account Yahoo Mail you have (some are not available with the free version). I can't any more detailed data without setting up an account of myself (and I don't want one). I can't help you further with your search because you did not provide the e-mail program, you are using or the version of Vista you are using.
I hope this helps. If you need more information, give me more information.
Good luck!
Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.
-
Find the table of characters on my computer if it is not in the accessory file
I write a scientific article for the school and could not find the table of characters on my computer. I looked in Accessories - System Tools and nothing. I should I reinstall or at least find a site online that will show you the appropriate key strokes to get what I'm looking for
Hello
Start - type in the search box-> find the table of characters at the top of list - double click it to run it.
You can also right click and COPY then PASTE an icon on the desktop or the start menu.
I hope this helps.
Rob Brown - MS MVP - Windows Desktop Experience: Bike - Mark Twain said it right.
-
REP-0737: must be a function of return type 'ref cursor.
Hi all
I have create a ref cursor query in reports 10 g. But it is giving error REP-0737: must be a function of return type 'ref cursor.
Here is my code
function QR_1RefCurDS return sys_refcursor is My_Cur Sys_Refcursor; begin Open My_Cur for select * from scott.emp order by deptno; return My_Cur end;
fate of the screen.
Oracle Forms/Reports has a complete PL/SQL engine and (only) the SQL parser.
However, the engine of forms/States PL / SQL and SQL Analyzer are at a level that was in the Oracle 8.0 database.
So, in the forms/States functions/procedures and forms/States triggers, you can not use SQL commands that did not exist in the 8.0 database.
The predefined SYS_REFCURSOR type is introduced in Oracle 9i.
Use this:
PACKAGE test_rc IS
TYPE of rc_type IS REF CURSOR RETURN emp % ROWTYPE;
END;
FUNCTION RETURN QR_1RefCurDS Test_rc.rc_type IS
test_rc.rc_type RC;
BEGIN
OPEN the RC to SELECT * FROM emp;
RETURN rc;
END;
Kind regards
Zlatko
-
Hi all, I would like to know if someone has developed a script to find all tables containing the columns (fields) specific.
I'm on a migration project where I don't have access to the source of the DB, I just ask for queries and I to reflect all the tables DB containing specific data of organization.So the first step was to understand used tables and I get them, now I understand what tables have Org_id / Organization_ID and fields of the SOURCE of the LANGUAGE/LANGUAGE (source DB has much set Org and many languages also, so I need to filter the 100total 6ORG_ID and 2 languages of 8 total installed)
Can anyone help?
Thank you
Best regards
Pietro
Hello
You can see this:
Find all tables in db with the name of the column of a particular string?
Kind regards
MihaiF
Maybe you are looking for
-
I use iphone 6 - IOS 9.3.4. When I press the button to lock the call entering Cup instead just of inhibition vibration and ring tone. Is it possible to change this setting, the lock button?
-
The user's privileges are not be correct.
Probably about six or seven months ago a few changes have taken place in my system that causes the user's privileges in newly created records files to create one or the other a very low (or nonexistent) level. My system has two user established ID: d
-
Can not copy or scan of FDA (autofeed) on LaserJet 127fn MFP
You just bought a LaserJet MFP M127fn Pro and the document feeder makes a cracking noise. The copies come out blurred from the ADF. Sometimes, I get a message to mispick or paper the ADF is not detected
-
10/100 BASE - T Ethernet LAN integrated unidentified
Hi all; My book is not HP Compaq CQ58-D56se and me cannot identify ethernet controller and I cann't find the driver on the internet, so I can't connect to my wired network friend? !! Help, please
-
Install RVS4000 with ADSL modem / router combo?
I am trying to install a VPN RVS4000 router in our small office. My problem is that AT & T has installed a Netopia 3347-02 combination of DSL Modem / Router. So I can not connect the RVS4000 directly to a dsl modem, the only access I have is on the