How to execute a xquery transformation loaded dynamically
Hi all,
I wrote a simple java class that exposes a method for returning a xml string containing a XQuery transformation, let's say myXQ.
Then I used a java callout action in order to execute this java class and store the result (that is myXQ) into a variable called myTransf.
Now I would like to ask ALSB to execute this myTransf and I'm looking a way, through an assign action (or in another way), to specify to use myTransf as a XQuery resource.
Is this possible ? Do you know a way to do what I'm looking for ?
Regards
Patrizio
Hi,
this should work :SQL> declare
2 l_sql varchar2(100);
3 l_result varchar2(30);
4 begin
5 dbms_output.put_line('before exec : '||l_result);
6 l_sql := 'select to_char(sysdate,''yyyymmdd'') from dual' ;
7 execute immediate l_sql into l_result ;
8 dbms_output.put_line('after exec : '||l_result);
9 end;
10 /
before exec :
after exec : 20100917
Similar Messages
-
How to use Lazy and Eager loading dynamically
Hi
I am using JPA.I have a table which has one to many realtionship with another table. I want lazy loading by default and eager loading in a speciific case.
Can we change this fetch type at the time of query?
Thanks
SateeshIn EclipseLink 2.1 there is also a LoadPolicy that allows a relationship to be loaded on a query.
query.setHint("eclipselink.load-group.attribute", "d.employees");
The difference between it and fetch, is that it is loaded normally (or as configured) not fetch joined.
James : http://www.eclipselink.org -
Table to load dynamically using sqlloader.
how to specify which table to load dynamically using sqlloader. We are using sqlldr in a script as given below...
sqlldr user/pass control=/control/loader.ctl log=/log/logger.log bad=/bad/badrec.bad data=/data/d1.txtHello, you'd need to build the necessary control files through a shell script, here is an example:
# Write sqlplus commands to control_file.sql
echo "set head off
set feedback off
set pagesize 0
set termout off" > control_file.sql
# read table and column list from table.dat
more table.dat |awk '{print $1}' |
while read TAB
do
echo "Table ${TAB}"
read COLUMNS
STR="nothing"
if test "$TABLE_LIST" = "empty"
then
TABLE_LIST="'$TAB'"
else
TABLE_LIST="$TABLE_LIST,'$TAB'"
fi
# construct select to load data - creating SQL*Loader control files
echo "set head off\n
set feedback off\n
set pagesize 0\n
select column_name||' '||
decode(data_type,'VARCHAR2',' char ('||DATA_LENGTH||')',
'CHAR',' char ('||DATA_LENGTH||')','DATE',' date (20) \"DD-MON-YYYY HH24:MI:SS\"','')
from user_tab_columns
where table_name ='$TAB'
order by 1;\n" | $ORACLE_HOME/bin/sqlplus -s $USR | awk '{print $1" "$2" "$3" "$4" "$5}' |
# read the columns in and concatenate them together to form the control file select
while read COLUM
do
if test "$STR" = "nothing"
then
STR="\nspool $TAB.CTL\nselect 'LOAD DATA\nINFILE \"$TAB.DMP\"\nBADFILE \"$TAB.BAD\""
STR="$STR\nDISCARDFILE \"$TAB.DIS\"\nDISCARDMAX 99\nTRUNCATE"
STR="$STR\nCONTINUEIF LAST != \"$FIELD_ENCLOSURE2\"\nINTO TABLE $TAB"
#STR="$STR INTO TABLE $TAB"
STR="$STR\nFIELDS TERMINATED BY \"$FIELD_DELIMITER\""
STR="$STR ENCLOSED BY \"$FIELD_ENCLOSURE\" AND \"$FIELD_ENCLOSURE2\""
STR="$STR\n TRAILING NULLCOLS"
STR="$STR\n($COLUM"
else
STR="$STR,\n$COLUM"
fi
done
STR=" $STR)'\nFROM DUAL;\nspool off\n"
echo "$STR" >> control_file.sql
done -
How to add all namespaces in root node of xquery transformation result?
Hi,
I'm using xquery Transformation in oracle service bus to transfrom output. The schema used for output transfromation has elements being imported from several schemas. so that output xml has these long tags with namespaces of repective schemas e.g.
<rr:Get360ViewOfProductResponse xmlns:rr="http://canaldigital.com/schema/product/CPMProductInformation/v2.0/">
<ResponseHeader>
<com:ResponseCode xmlns:com="http://broadcast.telenor.com/tsi/common/commonparameters_v1" >0</com:ResponseCode>
<com:ResponseText xmlns:com="http://broadcast.telenor.com/tsi/common/commonparameters_v1" >0</com:ResponseText>
</ResponseHeader>
</rr:Get360ViewOfProductResponse>
what I want to achieve is that all namespaces come once in the rootNode and all childnodes just use the repective prefixes, so that the xml size doesnt grow too large.Like below.
<rr:Get360ViewOfProductResponse xmlns:com="http://broadcast.telenor.com/tsi/common/commonparameters_v1" xmlns:rr="http://canaldigital.com/schema/product/CPMProductInformation/v2.0/" xmlns:pr="http://broadcast.telenor.com/tsi/common/program_v1">
<ResponseHeader>
<com:ResponseCode>0</com:ResponseCode>
<com:ResponseText>0</com:ResponseText>
</ResponseHeader>
</rr:Get360ViewOfProductResponse>
the difference is that ResponseCode and responseText should only use their prefix, and not complete namespace. How can i acheive this.
Thanks in advance.
Edited by: 856401 on Feb 9, 2012 1:53 AMI get error 'Invalid expression- Unexpected token copy-namespaces'. Is it supported by xquery version 1.0 ? Following is the updated xquery transformation which gives static error:
xquery version "1.0" encoding "Cp1252";
(:: pragma bea:global-element-parameter parameter="$get360ViewOfProductResponse1" element="ns5:Get360ViewOfProductResponse" location="../XSD/CPMSchema_v20.xsd" ::)
(:: pragma bea:global-element-return element="ns6:Get360ViewOfProductResponse" location="../XSD/CPMSchema_v3.xsd" ::)
declare namespace ns2 = "http://broadcast.telenor.com/tsi/common/displayinformation_v1";
declare namespace ns1 = "http://broadcast.telenor.com/tsi/common/commonparameters_v1";
declare namespace ns4 = "http://broadcast.telenor.com/tsi/common/Property_v2";
declare namespace ns3 = "http://broadcast.telenor.com/tsi/common/ProductMain_v2";
declare namespace ns0 = "http://broadcast.telenor.com/tsi/common/condition_v1";
declare namespace ns9 = "http://broadcast.telenor.com/tsi/common/extension_v1";
declare namespace ns5 = "http://broadcast.telenor.com/tsi/psd/cpm/CPMSchema_v20";
declare namespace ns6 = "http://canaldigital.com/schema/product/CPMProductInformation/v3.0/";
declare namespace xf = "http://tempuri.org/CPM_OSB_v3/XQuery/Get360ViewOfProductResponse/";
declare namespace ns7 = "http://broadcast.telenor.com/tsi/common/productofferingpricewithrules_v2";
declare namespace ns8 = "http://broadcast.telenor.com/tsi/common/pricecomponent_v2";
declare copy-namespaces preserve, inherit;
declare function xf:Get360ViewOfProductResponse($get360ViewOfProductResponse1 as element(ns5:Get360ViewOfProductResponse))
as element(ns6:Get360ViewOfProductResponse) {
<ns6:Get360ViewOfProductResponse>
<ResponseHeader>
<ns1:ResponseCode>0</ns1:ResponseCode>
<ns1:ResponseText>{ data($get360ViewOfProductResponse1/responseDescription) }</ns1:ResponseText>
</ResponseHeader>
</ns6:Get360ViewOfProductResponse>
declare variable $get360ViewOfProductResponse1 as element(ns5:Get360ViewOfProductResponse) external;
xf:Get360ViewOfProductResponse($get360ViewOfProductResponse1) -
How to execute several ROUNDS in a single transformation file?
Hi everybody,
I've put several transformation files into one transformation file but I have the following problems:
- when I look at the log after validating the transformation file, it only shows values for the last combination of OPTIONS / MAPPING / CONVERSION
- when I execute the package for loading dat into the cube, it ONLY loads data for the last combination of OPTIONS / MAPPING / CONVERSION that appears in the transformation file
The number of 'Submit record count' is always the same as the number of accepted records of the last round. And if I create a view from the target cube, it only has data for the last combination of OPTIONS / MAPPING / CONVERSION.
What is happening? Do I must change any parameter?
It's critical for the project as we are loading a lot of key figures and we must simplify the administration of the load process
Thanks a lot in advance for your support,
Albert MasHi,
Please try (for Windows):
Double click printer icon on desktop,
Select Scan a Document or Photo,
Put the first page on the glass (face down),
Check options (size, dpi ...), and select Scan document to file,
Click Scan - machine will scan the first page
Remove the first page on the glass, put the second page,
Click + (plus sign) It sits on the left hand side of a red x
Machine will scan the second page, put 3rd page on the glass and click + again ..... to the end then click Save
Click Done after Save
Regards.
BH
**Click the KUDOS thumb up on the left to say 'Thanks'**
Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem. -
How to call business service from xquery transformation in OSB ??
Hi All,
How to call business service from xquery transformation in OSB ??
I need to assign the response variable of Business Service to a target element in XQuery Transformation Mapper file.
It's urgent.
Regards,
Jyoti NayakTransformation is to mapping the source and target of 2 different schemas.
In your case you should have a XQuery transformation between, your Business Service output schema and the target schema.
Thanks,
Vijay -
How to include the first row of detail in every xquery transformed xml?
I am dealing with a XML file,where i need to publish to different BS.
First node will be a common node node which contains vital info,second node goes to one BS and third goes to another BS.
*<header></header>*
*<details></details> (they are unbounded, but the first detail tag which comes in the input file is a mandatory tag in such a way that it needs to be included in every transformed message)*
*<trailer></trailer>*
We need to apply x query transformation on it in such a way:
*</header></header>*
*<1st detail></1st detail>*
*<detail></detail> (2nd row of detail in input file)* -------------------------> Goes to BS1
*<trailer></trailer>..*
*<header></header>*
*<1st detail></1st detail>*
*<detail></detail> (3rd row of detail in input file)* ----------------------------->Goes to BS2
*<trailer></trailer>*..
And so on.
Now, the problem is how to include the first row( *1st detail* ) of detail in every xquery transformed xml?are you looping of this input with a for each?
/yourdata/details[1] should return always the first detail element.
or before the for each do an assing of this first detail element to "generic_details_var"
and use this var in every looping iteration (in an assign or as input for xquery) -
How to execute the method of a class loaded
Hi,
I have to execute the method of com.common.helper.EANCRatingHelper" + version
version may be 1,2, etc
if version = 1 the class is com.common.helper.EANCRatingHelper1;
Iam able to load the class using following code.But iam unable to execute the method of the above class
Can anybody help me how to execute the method of the class loaded.
Following is the code
String version = getHelperClassVersion(requestDate);
String helperClass = "com.redroller.common.carriers.eanc.helper.EANCRatingHelper" + version;
Class eancRatingHelper = Class.forName(helperClass);
eancRatingHelper.newInstance();
eancRatingHelper.saveRating(); This is not executing throwing an error no method.
ThankseancRatingHelper.newInstance();Ok, that creates an instance, but you just threw it away. You need to save the return of that.
Object helper = eancRatingHelper.newInstance();
eancRatingHelper.saveRating(); This is not executing throwing an error no method.Of course. eancRatingHelper is a Class object, not an instance of your EANCRatingHelper object. The "helper" object I created above is (though it is only of type "Object" right now) -- you have to cast it to the desired class, and then call the method on that.
Hopefully EANCRatingHelper1 and 2 share a common interface, or you're up the creek. -
How to execute dynamic if statement...
Hi All,
My PL/SQL Blocks looks like this
declare
i_string :='if 3>20 then 1 else 2 end if;' varchar2(100);
begin
end;
Between begin and end i want a piece of code which executes that if statement and sends 2 as output in dbms_output.put_line since 3 is not >20 .Basically i want to know how to execute dynamic if statement.Please help
Thanks,
PreethiHi,
i agree with Cyn. Dynamic SQL is often a bad idea. Try to avoid it.
Dynamic PL/SQL is even worse. If you really must do something dynamic, at least try to cast it as SQL rather than PL/SQL.
Does this do what you want?
CREATE OR REPLACE FUNCTION eval_case
( in_txt IN VARCHAR2
RETURN NUMBER
DETERMINISTIC
IS
return_val NUMBER;
sql_txt VARCHAR2 (1000);
BEGIN
sql_txt := 'SELECT CASE '
|| in_txt
|| ' END'
|| ' FROM dual';
EXECUTE IMMEDIATE sql_txt INTO return_val;
RETURN return_val;
END eval_case;
SHOW ERRORSYou might use the function above like this:
declare
i_string varchar2(100) :='WHEN 3>20 THEN 1 ELSE 2';
begin
dbms_output.put_line ( TO_CHAR (eval_case (i_string))
|| ' = results of eval_case ('''
|| i_string
|| ''')'
end;
/ -
How to execute a exe file using javascript on app window.load.
How to execute a exe file using javascript on app window.load.
Hi sb00349044,
As I have already mentioned in multiple replies to your previous questions, the SUMO forums focuses on providing help to end users with usage-questions and issues.
For developer-related questions, please refer to one of the many resources readily available that I have linked to in the past:
* [https://developer.mozilla.org/en-US/Firefox_OS MDN]
* [http://stackoverflow.com/questions/tagged/firefox-os StackOverflow]
* [https://lists.mozilla.org/listinfo Mozilla Mailing Lists]
- Ralph -
How to execute a method after page Load?
My question is very similar to what was discussed in following thread:
How to execute a method after page Load?
My requirement is that I want to run a method in backing bean of a page, immediately after the page gets loaded. In that method I want to invoke one of the method action included in the pagedef of this page, conditionally.
I tried using the approach given in the above thread, i.e to use <f:view afterPhase="#{backing_security.setPermPriv}">, but the problem is that our page is not using 'f:view' , so I explicitly added one f:view with afterPhase property set , but it is not working, page it self is not getting loaded, it is throwing the error:
Root cause of ServletException.
java.lang.IllegalStateException: <f:view> was not present on this page; tag [email protected]e8encountered without an <f:view> being processed.
at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.setProperties(UIXComponentELTag.java:108)
at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:733)
at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:1354)
at org.apache.myfaces.trinidad.webapp.UIXComponentELTag.doStartTag(UIXComponentELTag.java:71)
at oracle.adfinternal.view.faces.taglib.UIXQueryTag.doStartTag(UIXQueryTag.java:41)
at oracle.adfinternal.view.faces.unified.taglib.UnifiedQueryTag.doStartTag(UnifiedQueryTag.java:51)
at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:262)
at oracle.jsp.runtime.tree.OracleJspNode.execute(OracleJspNode.java:89)
at oracle.jsp.runtimev2.ShortCutServlet._jspService(ShortCutServlet.java:89)
at oracle.jsp.runtime.OracleJspBase.service(OracleJspBase.java:29)
at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:665)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:387)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:822)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:746)
Please help to resolve this issue, or am I doing anything wrong?Hi,
I assume that your view is a page fragment and here - indeed - the f:view tag cannot be used. If you use ADF then one option would be to use a custom RegionController on the binding layer to listen for the render phase to invoke the method. Another option would be to use a hidden field (output text set to display="false" and have this component value referencing a managed bean property. The managed bean property's getter method can now be used to invoke the method you want to run upon view rendering
Frank -
The information to be shown on the page has to be loaded dynamically from the database. As opposed to creating in static jsp pages, the fields and their attributes (name, label, etc.) are stored in the database tables, mag_registration_form_header and mag_registration_form_fields.
So somehow i have to be able to display all the fields and there data on a JSP. The motive behind this is that there will be something like a common template which many modules can use and there will be a single jsp file which will display the contents as per the event...
The template will be prepared in the java end..
This has to be done using struts framework....AJAX (and a JSP/Servlet that delivers the info the AJAX call requests).
Edit: If you're talking about changing info already appearing on a loaded page.
And how is the answer not JSP, when you yourself said you would use JSP to display it.
I don't believe you know enough about any of this to even be starting on this "project". -
How to validate a date in xquery transformation
i am doing the xquery transformation for mfl(non-xml) and xml
i have a date-pickup and i should validate this field as my datatype is date , instead of date i am getting the data as 00000000 ,my date-pickup format is yyyymmdd
can we do a validation for this specific field and all the failed date validations should be written as blank tag in xsd
Please give me a suggestion for thisHi,
There's a xquery extension function that you can use for that
fn-bea:date-from-string-with-format
The fn-bea:date-from-string-with-format() function returns a new date value from a string source value according to the specified pattern.
The function has the following signature:
fn-bea:date-from-string-with-format($format as xs:string?, $dateString as xs:string?) as xs:date?
where $format is the pattern and $dateString is the date. For more information about specifying patterns, see Date and Time Patterns.
Examples:
fn-bea:date-from-string-with-format("yyyy-MM-dd G", "2005-06-22 AD") returns the specified date in the current time zone.
fn-bea:date-from-string-with-format("yyyy-MM-dd", "2002-July-22") generates an error because the date string does not match the specified format.
fn-bea:date-from-string-with-format(“yyyy-MMM-dd”, “2005-JUL-22”) returns the specified date in the current time zone.
http://docs.oracle.com/cd/E13162_01/odsi/docs10gr3/xquery/extensions.html#wp1297249
Cheers,
Vlad
It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts)
https://forums.oracle.com/forums/ann.jspa?annID=893 -
How to Execute a Remote Procedure in Portal using Database Link
Hi,
I followed the instructions to create a Portal form for a remote procedure. But I am encountering the following error. Can someone advise what may be the cause?
Failed to execute - Missing string(create_package_body) language(us) domain (wwv) sub_domain (wwv_builder) (WWV-04300)
ORA-04020: deadlock detected while trying to lock object PUBLIC.PORTLET_SCHEMA (WWV-11230)
Failed to parse as PORTAL - (WWV-08300)
PURPOSE
How to execute a remote procedure in Portal using Database Link.
DESCRIPTION
This procedure assumes that you have two databases, one of which is remote, and Portal is configured in the other.
Remote Database A:
==================
1) Create a procedure as follows: Create or Replace PROCEDURE SCOTT.ADD_TWO_VALUES ( v_one IN NUMBER, v_two IN NUMBER, v_result OUT NUMBER) as begin v_result :=v_one+v_two; end; 2) Grant execute privileges to PUBLIC on the procedure.
Database B (where Portal is configured): ========================================
1) Create a public database link and choose to connect as a specific user (say SYSTEM). By default, in an Oracle 8i database, the "global_names" parameter in initSID.ora (or init.ora) file is set to "true". This Global Naming parameter enforces that a dblink has the same name as the database it connects to. Therefore, if the remote global database (A) name is "ora8.acme.com" then the database link should also be named as "ora8.acme.com".
2) Create a synonym for the procedure in Database A. Make sure you fully qualify the procedure name in the remote database (like SCOTT.ADD_TWO_VALUES).
3) Create a dynamic page to execute the procedure. The ORACLE tags in the dynamic page will look similar to the following: <ORACLE> DECLARE v_total NUMBER; BEGIN ADD_TWO_VALUES(:v_one,:v_two, v_total); htp.p('The total is => '); htp.p('<input type="TEXT" VALUE='||v_total||'>'); htp.para; htp.anchor('http://<machine.domain:port#>/pls/portal30/SCOTT.DYN_ADD_TWO_VALUES.show_parms', 'Re-Execute Procedure'); END; </ORACLE>
4) Portal does not have an option to create a form based on a synonym. Therefore, if you want to create a form instead of a dynamic page, create a wrapper procedure and then create a form based on this procedure. For example: Create or Replace PROCEDURE PORTAL30.ADD_TWO_VALUES_PR ( v_one IN NUMBER, v_two IN NUMBER, v_total OUT NUMBER) as begin add_two_values(v_one, v_two, v_total); end;
5) Grant execute privileges to PUBLIC on the procedure.hello...
any input will welcomed... Thanks.. -
Convertion of String to XML node using Xquery transformation in OSB
How to convert string to XML node elementusing a built in function using Xquery transformation in OSB?
check this out - http://www.javamonamour.org/2011/06/fn-beainlinedxml.html
if in SOA (BPEL & Mediator) you can use oraext:parseXML.
you should thoroughly analyse where to implement your requirement as some good practices advise to implement more complex logic in SOA and leave OSB to only connect to the services' endpoints.
Hope this helps,
A.
Maybe you are looking for
-
Can't write in Pages 09 documents with Mavericks
So I accidentally upgraded to Pages 5 on my ipad so then I had to install Mavericks and Pages 5 on my MacBook too (to allow syncing). Now Pages 5 is a complete disaster. It screws up all the lay-outs I created in 09 and doesn't allow me to create new
-
I have an iPhone and use Roadrunner as my email server. When I open RR it gives me 4 choices, inbox, drafts, sent and trash. I would like to add saved, how can I do this. I contacted RR and they said it is an Apple problem to solve.
-
WARNING! Server MOM has experienced a critical error.
Good Afternoon, I work for a non-profit with a single Novell server that is mainly used for Faxpress and File Shares. Today before I was about to leave I was hit with WARNING! Server MOM has experienced a critical error. It is going down in 2 minutes
-
Browse Documents in Advanced Search iView
Hi, I am trying to develop a Search Component. I need to include a Browse Document also in the component as in the advanced search. How can we do this? Regards BP
-
Issues syncing with OneNote 2013 and skydrive
Hi Support I had a syncing issue on one of my OneNote notebooks. I used the MS help and they suggested that I confirm that the notebook is on the Skydrive web access, which it is, and then close the notebook. I have done that. Now when i try and ope