I need to pass a query in form of string to DBMS_XMLQUERY.GETXML package...the parameters to the query are date and varchar ..please help me..
I need to pass a query in form of string to DBMS_XMLQUERY.GETXML package...the parameters to the query are date and varchar ..please help me build the string .Below is the query and the out put. ( the string is building fine except the parameters are with out quotes)
here is the procedure
create or replace
procedure temp(
P_MTR_ID VARCHAR2,
P_FROM_DATE IN DATE ,
P_THROUGH_DATE IN DATE ) AS
L_XML CLOB;
l_query VARCHAR2(2000);
BEGIN
l_query:= 'SELECT
a.s_datetime DATETIME,
a.downdate Ending_date,
a.downtime Ending_time,
TO_CHAR(ROUND(a.downusage,3),''9999999.000'') kWh_Usage,
TO_CHAR(ROUND(a.downcost,2),''$9,999,999.00'') kWh_cost,
TO_CHAR(ROUND(B.DOWNUSAGE,3),''9999999.000'') KVARH
FROM
(SELECT s_datetime + .000011574 s_datetime,
TO_CHAR(S_DATETIME ,''mm/dd/yyyy'') DOWNDATE,
DECODE(TO_CHAR(s_datetime+.000011574 ,''hh24:'
||'mi''), ''00:'
||'00'',''24:'
||'00'', TO_CHAR(s_datetime+.000011574,''hh24:'
||'mi'')) downtime,
s_usage downusage,
s_cost downcost
FROM summary_qtrhour
WHERE s_mtrid = '
||P_MTR_ID||
' AND s_mtrch = ''1''
AND s_datetime BETWEEN TO_DATE('
||P_FROM_DATE||
',''DD-MON-YY'') AND (TO_DATE('
||P_THROUGH_DATE||
',''DD-MON-YY'') + 1)
) a,
(SELECT s_datetime + .000011574 s_datetime,
s_usage downusage
FROM summary_qtrhour
WHERE s_mtrid = '
||P_MTR_ID||
' AND s_mtrch = ''2''
AND s_datetime BETWEEN TO_DATE('
||P_FROM_DATE||
',''DD-MON-YY'') AND (TO_DATE('
||P_THROUGH_DATE||
','' DD-MON-YY'') + 1)
) B
where a.S_DATETIME = B.S_DATETIME(+)';
SELECT DBMS_XMLQUERY.GETXML('L_QUERY') INTO L_XML FROM DUAL;
INSERT INTO NK VALUES (L_XML);
DBMS_OUTPUT.PUT_LINE('L_QUERY IS :'||L_QUERY);
END;
OUTPUT parameters are in bold (the issue is they are coming without single quotes otherwise th equery is fine
L_QUERY IS :SELECT
a.s_datetime DATETIME,
a.downdate Ending_date,
a.downtime Ending_time,
TO_CHAR(ROUND(a.downusage,3),'9999999.000') kWh_Usage,
TO_CHAR(ROUND(a.downcost,2),'$9,999,999.00') kWh_cost,
TO_CHAR(ROUND(B.DOWNUSAGE,3),'9999999.000') KVARH
FROM
(SELECT s_datetime + .000011574 s_datetime,
TO_CHAR(S_DATETIME ,'mm/dd/yyyy') DOWNDATE,
DECODE(TO_CHAR(s_datetime+.000011574 ,'hh24:mi'), '00:00','24:00', TO_CHAR(s_datetime+.000011574,'hh24:mi')) downtime,
s_usage downusage,
s_cost downcost
FROM summary_qtrhour
WHERE s_mtrid = N3165 AND s_mtrch = '1'
AND s_datetime BETWEEN TO_DATE(01-JAN-13,'DD-MON-YY') AND (TO_DATE(31-JAN-13,'DD-MON-YY') + 1)
) a,
(SELECT s_datetime + .000011574 s_datetime,
s_usage downusage
FROM summary_qtrhour
WHERE s_mtrid = N3165 AND s_mtrch = '2'
AND s_datetime BETWEEN TO_DATE(01-JAN-13,'DD-MON-YY') AND (TO_DATE(31-JAN-13,' DD-MON-YY') + 1)
) B
where a.S_DATETIME = B.S_DATETIME(+)
The correct way to handle this is to use bind variables.
And use DBMS_XMLGEN instead of DBMS_XMLQUERY :
create or replace procedure temp (
p_mtr_id in varchar2
, p_from_date in date
, p_through_date in date
is
l_xml CLOB;
l_query VARCHAR2(2000);
l_ctx dbms_xmlgen.ctxHandle;
begin
l_query:= 'SELECT
a.s_datetime DATETIME,
a.downdate Ending_date,
a.downtime Ending_time,
TO_CHAR(ROUND(a.downusage,3),''9999999.000'') kWh_Usage,
TO_CHAR(ROUND(a.downcost,2),''$9,999,999.00'') kWh_cost,
TO_CHAR(ROUND(B.DOWNUSAGE,3),''9999999.000'') KVARH
FROM
(SELECT s_datetime + .000011574 s_datetime,
TO_CHAR(S_DATETIME ,''mm/dd/yyyy'') DOWNDATE,
DECODE(TO_CHAR(s_datetime+.000011574 ,''hh24:'
||'mi''), ''00:'
||'00'',''24:'
||'00'', TO_CHAR(s_datetime+.000011574,''hh24:'
||'mi'')) downtime,
s_usage downusage,
s_cost downcost
FROM summary_qtrhour
WHERE s_mtrid = :P_MTR_ID
AND s_mtrch = ''1''
AND s_datetime BETWEEN TO_DATE(:P_FROM_DATE,''DD-MON-YY'')
AND (TO_DATE(:P_THROUGH_DATE,''DD-MON-YY'') + 1)
) a,
(SELECT s_datetime + .000011574 s_datetime,
s_usage downusage
FROM summary_qtrhour
WHERE s_mtrid = :P_MTR_ID
AND s_mtrch = ''2''
AND s_datetime BETWEEN TO_DATE(:P_FROM_DATE,''DD-MON-YY'')
AND (TO_DATE(:P_THROUGH_DATE,'' DD-MON-YY'') + 1)
) B
where a.S_DATETIME = B.S_DATETIME(+)';
l_ctx := dbms_xmlgen.newContext(l_query);
dbms_xmlgen.setBindValue(l_ctx, 'P_MTR_ID', p_mtr_id);
dbms_xmlgen.setBindValue(l_ctx, 'P_FROM_DATE', to_char(p_from_date, 'DD-MON-YY'));
dbms_xmlgen.setBindValue(l_ctx, 'P_THROUGH_DATE', to_char(p_through_date, 'DD-MON-YY'));
l_xml := dbms_xmlgen.getXML(l_ctx);
dbms_xmlgen.closeContext(l_ctx);
insert into nk values (l_xml);
end;
Similar Messages
-
Hi! I cant conect The face time betwen my iPad ,iPod and iPhone, please help me,what i need for this issue?
What is it doing when you try to facetime? also if you are using the same apple Id/email on each device, it wont work.
-
I Lost all my data because i forgot my password and reset my mac, and i need it all back Please help!!
What do you mean by "reset my mac"?
-
My hard disk crashed and I cannot find out how to "contact customer service" other than this forum. The website seems to just take me in a circle. I need to de-activate a license but cannot access the software due to a crashed hard drive. Please help.
Hi Anthony ,
Here is the link to connect with Adobe Chat Support.
https://helpx.adobe.com/adobe-connect/kb/connect-chat-support.html
Hope your query gets resolved .
Regards
Sukrit Dhingra -
Hi,
My iphone 4 won't connect to my mac book, it says that I need to install to latest version of itunes 11.1. When I go to itunes and try to update, it says that I have the latest version (10.6.3). Can someone please help me!
thanksYou are probably running OS 10.4 or 10.5 on a PPC Mac. No version of iTunes higher than 10.6.3 is available for these older Macs. I have the same problem, and while I can still use the PPC to sync my iPod, it can't be used to sync an iPhone 4 or higher. The only solution, as I discovered after upgrading to the iPhone 4, is to buy a newer Mac. I was able to get a 2006 MacBook running Lion for under $300, and that has been a lifesaver.
-
My iPod touch is permanently disabled and it says to connect my iPod to my iTunes yet when I do that, it tells me to type in pass code even though it's still disabled. i cant go to DFU mode cause my home button is broken PLEASE HELP ME GOD I MISS MY IPOD TOUCH PLEASE :'((
i cant do that sir ,my ipod touch 4g keeps rebooting and rebooting all over again until the battery is empty HELP GUYS PLEASE
-
I lost my ipad and i need the serial number and IMEI , please help me how?
i lost my ipad and i need the serial number and IMEI , please help me how?
If you have registered your device, you can go to https://supportprofile.apple.com/ and log into your apple id. Your devices appear there with serial numbers.
Additionally, your serial number is included on the original receipt when purchased at any Apple Online or Apple Retail store, or any Authorized Apple Reseller. -
Hai, i tried to open itunes on my windows 8 laptop but it comes out with 'iTunes has stop working' notification and need to close the program everytime i try to load it. Please help! thanks.
Hi ajay-9,
Thanks for visiting Apple Support Communities.
The steps in this article can help if iTunes is quitting unexpectedly on your PC:
iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues
http://support.apple.com/kb/ts1717
Cheers,
Jeremy -
I just can't find the question... I need to fix the apps that I downloaded & it's not completing the download even on Wi-Fi??? Please help!!!!!!!!!
iOS: About File Sharing
-
I am having trouble printing I have a connection to my printer wirelessly but does not print out the correct page I want.When I do print I get a bunch of pages more than is needed and also get a code and symbols please help I am jammed at work
This can be the result of selecting the wrong driver. An older, unsupported laser printer will sometimes work with the generic Postscript driver.
-
I need to create a second back-up of iPhoto from Time Machine to a separate external drive. The old iPhoto in TM will not open. Please help! And thank you!
Most Simple Back Up:
Drag the iPhoto Library from your Pictures Folder to another Disk. This will make a copy on that disk.
Slightly more complex: Use an app that will do incremental back ups. This is a very good way to work. The first time you run the back up the app will make a complete copy of the Library. Thereafter it will update the back up with the changes you have made. That makes subsequent back ups much faster. Many of these apps also have scheduling capabilities: So set it up and it will do the back up automatically.
Example of such apps: Chronosync - but there are many others. Search on MacUpdate or the App Store -
I have been trying to put some of my music and artwork, on youtube. Youtube says you need an encoder to upload music. But the problem is the only encoders available are for windows. Please help, thank you
The formats YouTube supports can be found here:
http://www.google.com/support/youtube/bin/answer.py?answer=55744
Since YouTube supports AAC, the file format iTunes uses by default, it's probable you don't need any sort of converter.
If you continue to have problems with uploading to YouTube, I'd suggest you ask for assistance in their forums:
http://www.google.com/support/forum/p/youtube?hl=en
Regards. -
I upgraded my computer and need a link to download Acrobat Pro 9 MAC. I have my serial number but do not have my disc. Please help and send link. Thank you. My MacPro computer is slowly dying and I need to get going with Acrobat Pro 9.
Unfortunately, Adobe has quit support of earlier version. They have a version of AA9 Pro for Windows posted, but not for the MAC as I understand it. You can try Adobe Acrobat X (10) Pro, Reader, and Suite Direct Download Links | ProDesignTools, but again I can only find PC versions. Someone may drop by with a link or you might see if anyone locally has the CD (that you could get the install file from). You will still need to use your original S/N.
-
I lost my Iphone and I need IMEI number, but I have only serial number. Can I get IMEI number through Iphone serial number ? if possible please help and let me know how
If you go to the computer where your sync your phone to and open itunes and then go to edit in the tool bar then preferences then device preferences then devices.. hover the mouse pointer over your device name in the back up lists that appear there and it shows the IMEI
-
How to add the parameters onto the reports while calling from forms
Hi all,
I am using oracle forms 10g. I want to call a report from the form.
But i dont know how to add parameters to the url while using
web.show_document();
i have a sample code. But it does not add the forms values onto the url.
DECLARE
v_host varchar2(100);
v_port varchar2(10);
v_parameter_string varchar2(4000);
v_username varchar2(50);
v_password varchar2(50);
v_database varchar2(50);
BEGIN
-- Get the full domain name of the server from the formsweb.cfg
tool_env.getvar('SERVER_URL',v_host);
-- Get the username/password and database from the .env file
tool_env.getvar('APPLICATION_USERNAME',v_username);
tool_env.getvar('APPLICATION_PASSWORD',v_password);
tool_env.getvar('APPLICATION_DATABASE',v_database);
-- If it is localhost then we are running on windows and need to use the windows port, otherwise we
-- are on AIX and need to use the AIX port
IF v_host = 'localhost' THEN
v_port := '8889';
ELSE
v_port := '7778';
END IF;
-- Now build the parameter string for running the report
v_parameter_string := 'server=rep_fsprod';
v_parameter_string := v_parameter_string||'&report=AAP_TOTAL_CONTRACT_VALUE_RPT.rdf';
v_parameter_string := v_parameter_string||'&userid='||v_username||'/'||v_password||'@'||v_database;
v_parameter_string := v_parameter_string||'&execution_mode=batch';
v_parameter_string := v_parameter_string||'&comm_mode=synchronous';
v_parameter_string := v_parameter_string||'&destype=cache';
v_parameter_string := v_parameter_string||'&desformat=pdf';
-- Now run the report
web.show_document('http://'||v_host||':'||v_port||'/reports/rwservlet?'||v_parameter_string,'_blank');
END;
Are we able to add the text values in the form from to the URL.
Please let me know....
thanks in advance....
Naveenhello
read the following white paper http://www.oracle.com/technology/products/forms/pdf/10g/frm10gsrw10g.pdf
cheers
Q
Maybe you are looking for
-
Help Please! Genius AND WiFi not working on iPod
Hi, I'm using a first gen touch on the latest firmware. even though i have genius on iTunes, it will not transfer onto the iPod. There simply is no genius button. How can I get this working? Also, on an unrelated note, my WiFi is completely shot. The
-
Apple TV not showing up in device list
I just got a new iMac and had everything trasfer over to it from my old MacMini. Now Apple TV will not show up in the iMac's iTunes' device list.
-
Servlets in Jar files in WLS 6.1 ?
Trying to port a WLS 5.1 servlet into 6.1 (an entirely different animal it appears) I have added an application to my config.xml file as below as well as trying to start it PasswordPolicy="wl_default_password_p
-
MS Project Client import to cProjects
Hi all, does anybody have experience with the MS Project Client import to cProjects with regard to resource management? In my MS P file, I've"specified the fields "resource names" which should convert to "project roles" in cPro and "code" which shoul
-
Dust Under the Screen and Case Cracks
Hey guys, I am the proud owner of an iPhone 3G S, and love the thing to pieces. I've had it for 8 months now, however over the past few weeks, I have become slightly disappointed with it. Firstly, a small crack appeared above the 'Silent On/Off' swit