Problem using extract function (PL/SQL) with "&#34"
Hi,
When I use extract function (PL/SQL), it does not transform well """. Insted of returning ' " ' , it returns ' " '.
I know this works changing the code replacing xml.extract for SELECT extractvalue(xml,'//A/text()') into v from dual;
But Is there another way to do this using PL/SQL? any patch, option..?
Regards
Had to use my website to demonstrate the code...
As said, whatever I try here the code gets automatically converted...
See for answer on your question: http://www.liberidu.com/blog/?p=635
Similar Messages
-
Problem using Extract Function
My problem,
declare
v_clob clob;
begin
select extract(xml_details,'/ROWSET/ROW/CTRY_CODE').getStringVal() into v_clob from xml_tab where xml_name='GRN.XML';
end;
xml_tab description
column
xml_details clob
xml_name VARCHAR2(2000)
This block works fine for smaller xmls...but not working for large xmls.Clob can store a very large xml but using getStringVal() it cannot return large string size,how could i get large xml values from a xml.
Error shown: ORA-06502-String size too smallselect extract(xml_details,'/ROWSET/ROW/CTRY_CODE').getClobVal()
Without knowing your version, you may still run into an issue if the length of the data is > 64K. 9i truncs the data and goes on happily. 10g throws an error. 11g should handle correctly. -
Hi Guyz,
I am having small problem using LIKE function . The problem is I am using LIKE function in the WHERE clause
to compare a column to a particular value, which gets this value from the front end. If the user has a single quote in the string he entered then the LIKE function is not working because of the single quote. Is there any way I can escape the single quote like we escape '%' and '_'.
Thankyou.Mod_plsql supports bind variables, as do almost all front-end tools that deal with Oracle (and most other databases). I do not code mod pl/sql myself, but others here do, and I see bind variables in their code all the time (if I don't, they hear from me :-)).
If you pass a bind variable, the quote problem goes away. As far as I know (which is not very far), you should be able to take the string with the quote directly from your input field, bind it to the variable in your query and have no problems.
I suspect that the reson you are having issues is that you are just gluing strings together to create a sql statement. this is the wrong approach.
The java term for what you are looking for is prepared statement, I'm not sure what the equivalent is i mod plsql, but that should give you a start.
John -
Problem using two function based indexes at once!
Hello Oracle!
I've got problems using two function based indexes on geometries at once.
The problem occures, when I use a spatial join between two geometries both using function based indexes.
The test case:
CREATE TABLE quad (centroid NUMBER);
CREATE TABLE points (no NUMBER, point MDSYS.SDO_GEOMETRY);
CREATE OR REPLACE FUNCTION getQuad (centroid NUMBER) RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC IS
BEGIN
RETURN MDSYS.SDO_GEOMETRY(2003, NULL, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),MDSYS.SDO_ORDINATE_ARRAY(centroid-5,centroid-5,centroid+5,centroid-5,centroid+5,centroid+5,centroid-5,centroid+5,centroid-5,centroid-5));
END;
INSERT INTO USER_SDO_GEOM_METADATA VALUES('quad','tiedge.getQuad(centroid)',MDSYS.SDO_DIM_ARRAY(MDSYS.SDO_DIM_ELEMENT('X', -100, 100, .0000001), MDSYS.SDO_DIM_ELEMENT('Y', -100, 100, .0000001)),NULL);
CREATE INDEX quad_idx on quad(getQuad(centroid)) INDEXTYPE IS MDSYS.SPATIAL_INDEX;
INSERT INTO quad VALUES (0);
INSERT INTO quad VALUES (5);
INSERT INTO quad VALUES (10);
INSERT INTO points VALUES (1, MDSYS.SDO_GEOMETRY(1001,NULL,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),MDSYS.SDO_ORDINATE_ARRAY(4,4)));
ALTER SESSION SET QUERY_REWRITE_INTEGRITY=TRUSTED;
ALTER SESSION SET QUERY_REWRITE_ENA[i]Long postings are being truncated to ~1 kB at this time.hi there,
For a better audience for this question, I'd look at the database forum.
guys on that will be a lot more familiar with FBIs
thanks
Barry -
Problems using Sony ECM DS70P Microphone with Vado HD 3rd gen
Problems using Sony ECM DS70P Microphone with Vado HD 3rd genXHello.
I have just purchased a Vado HD 3rd gen & was looking forward to using my Sony ECM DS70p Microphone,but after a couple of tests, the recording is extremely low & barley laudable.
The Microphone works fine on My Kodak Zi8.
Is there an internal setting I have to adjust, or is there a fault with the Vado
The Sony ECM DS70pMicrophone can be clearly seen in use here on a official Creative video.
http://www.youtube.com/watchv=oixLDAmc5qw
If anybody can offer some help or advice please, I would be very grateful.
Does anyone have a suggestion for a low profile stereo mic, to use with the Vado 3rd Gen
Thank you.
Thank you.This is happening to me too, I don't know if this is an Adobe Flash Player 11.5's bug or it's just my computer. All my browsers, chrome, IE9, Fox, doesn't even load anime videos. I tried reinstalling 11.5 many times, it have no effect but I use IE9 64-bit to run the videos that couldn't run. I waited 25 min for a JW player to load an episode of anime and I'm sick of it.
-
Hi,
This is similar - yet different - to a few of the old postings about performance
problems with using jdbc drivers against Sql Server 7 & 2000.
Here's the situation:
I am running a standalone java application on a Solaris box using BEA's jdbc driver
to connect to a Sql Server database on another network. The application retrieves
data from the database through joins on several tables for approximately 40,000
unique ids. It then processes all of this data and produces a file. We tuned
the app so that the execution time for a single run through the application was
24 minutes running against Sql Server 6.5 with BEA's jdbc driver. After performing
a DBMS conversion to upgrade it to Sql Server 2000 I switched the jDriver to the
Sql Server 2000 version. I ran the app and got an alarming execution time of
5hrs 32 min. After some research, I found the problem with unicode and nvarchar/varchar
and set the "useVarChars" property to "true" on the driver. The execution time
for a single run through the application is now 56 minutes.
56 minutes compared to 5 1/2 hrs is an amazing improvement. However, it is still
over twice the execution time that I was seeing against the 6.5 database. Theoretically,
I should be able to switch out my jdbc driver and the DBMS conversion should be
invisible to my application. That would also mean that I should be seeing the
same execution times with both versions of the DBMS. Has anybody else seen a
simlar situation? Are there any other settings or fixes that I can put into place
to get my performance back down to what I was seeing with 6.5? I would rather
not have to go through and perform another round of performance tuning after having
already done this when the app was originally built.
thanks,
mikeMike wrote:
Joe,
This was actually my next step. I replaced the BEA driver with
the MS driver and let it run through with out making any
configuration changes, just to see what happened. I got an
execution time of about 7 1/2 hrs (which was shocking). So,
(comparing apples to apples) while leaving the default unicode
property on, BEA ran faster than MS, 5 1/2 hrs to 7 1/2 hrs.
I then set the 'SendStringParametersAsUnicode' to 'false' on the
MS driver and ran another test. This time the application
executed in just over 24 minutes. The actual runtime was 24 min
16 sec, which is still ever so slightly above the actual runtime
against SS 6.5 which was 23 min 35 sec, but is twice as fast as the
56 minutes that BEA's driver was giving me.
I think that this is very interesting. I checked to make sure that
there were no outside factors that may have been influencing the
runtimes in either case, and there were none. Just to make sure,
I ran each driver again and got the same results. It sounds like
there are no known issues regarding this?
We have people looking into things on the DBMS side and I'm still
looking into things on my end, but so far none of us have found
anything. We'd like to continue using BEA's driver for the
support and the fact that we use Weblogic Server for all of our
online applications, but this new data might mean that I have to
switch drivers for this particular application.Thanks. No, there is no known issue, and if you put a packet sniffer
between the client and DBMS, you will probably not see any appreciable
difference in the content of the SQL sent be either driver. My suspicion is
that it involves the historical backward compatibility built in to the DBMS.
It must still handle several iterations of older applications, speaking obsolete
versions of the DBMS protocol, and expecting different DBMS behavior!
Our driver presents itself as a SQL7-level application, and may well be treated
differently than a newer one. This may include different query processing.
Because our driver is deprecated, it is unlikely that it will be changed in
future. We will certainly support you using the MS driver, and if you look
in the MS JDBC newsgroup, you'll see more answers from BEA folks than
from MS people!
Joe
>
>
Mike
The next test you should do, to isolate the issue, is to try another
JDBC driver.
MS provides a type-4 driver now, for free. If it is significantly faster,
it would be
interesting. However, it would still not isolate the problem, because
we still would
need to know what query plan is created by the DBMS, and why.
Joe Weinstein at BEA
PS: I can only tell you that our driver has not changed in it's semantic
function.
It essentially send SQL to the DBMS. It doesn't alter it. -
Extract function not working with tag attributes
Hi all,
I have an xml document stored in the db as an xmlType. I am trying to use the extract function to retrieve values. The extract will work fine on tags without attributes. Any tags with attributes or tags beyond the tags with attributes will not be accessible.
<tag1>
<tag2>hi</tag2>
<tag3 att="hello">bye</tag3>
<tag4> hi again </tag4>
</tag1>
In the example above I can extract tag2 values but not tag3 or tag4 values.
here is my select statement
works
select e.xmlval.extract('/tag1/tag2').getStringval()
from test_xml e;
does not work
select e.xmlval.extract('/tag1/tag2/tag3').getStringval()
from test_xml e;
does not work
select e.xmlval.extract('/tag1/tag2/tag3/tag4').getStringval()
from test_xml e;
Any ideas?Hi all,
Found the issue. The problem was that I was not specifying the second argument to the extract function.
The tag attribute that I was not handling was xmlns="".
I used this atttribute as the second argument in the extract function and now I am off and running.
Hope this helps someone.
Cheers -
Hi all,
My problem is that when i use ago function it displays next months value for example first column shows balance of april month and next to it ago column displays balance of the may not march. I am really confused. Please help,
AGO(SR02BriefIncome.sr02_cube.BALANCE, SR02BriefIncome.timesDim."times Detail", 1);Hi Nico,
Another question in relation to Ago function; I need to get value/balance a year ago which is 12 months ago, and also previous year's last months balances; the problem is that Ago function takes only integer, I have tried to put a variable, Is there is way i can get balances of the previous year's last month because it will be much easier to get it using built-in ago function.
Also i need help with your answer for thread How to use row values in Presentation or Administration for calculation
Re: How to use row values in Presentation or Administration for calculation
"Yes, I forgot this one. Of course, this solution work when you have a pivot column.
If you talk about period to period comparison, really often I must do a share like this one : ($2-$5)/$5.
And unfortunately, this is not possible in a calculated item. Is it ?"
We have a lot of reports with inter-row calculations, we have already used a lot sql model but we would like use answer also. Can u explain it with exact examples or steps.
thank you again, -
Problem using MDX functions in Answers Filter
I'm using OBIEE 10.1.3.2.
I'm using an Essbase cube as my datasource (aggregate storage).
My level 0 members in my Date dimension are of the format yyyy-mm-dd (e.g., 2011-08-13)
I have a dashboard prompt selecting the date from a calendar which returns the date and time (yyyy-mm-dd hh:mm:ss). So naturally I can't do just a straight equals between the prompt value and the member value.
What I've written in the filter sql in Answers is: Date.Days = Evaluate('SUBSTRING(%1,1,10)','@{varStartDate}')
The log shows the following:
-------------------- SQL Request:
SELECT Date.Days saw_0, main.total_completed_orders saw_1 FROM SIKAgg2 WHERE Date.Days = Evaluate('SUBSTRING(%1,1,10)','2011-08-09 00:00:00') ORDER BY saw_0
-------------------- Sending query to database named mezen (id: <<9648>>):
With
set [Date4] as 'Filter([Date].Generations(4).members, (([Date].CurrentMember.MEMBER_ALIAS = "2011-08-09 00:00:00" OR [Date].CurrentMember.MEMBER_Name = "2011-08-09 00:00:00")))'
select
{ [Measures].[total_completed_orders]
} on columns,
NON EMPTY {SUBSTRING(,1,10)SUBSTRING(,1,10)SUBSTRING(,1,10){[Date4]}} properties ANCESTOR_NAMES, GEN_NUMBER on rows
from [SIKAgg2.main]
So with all that being said it doesn't appear that the MDX function SUBSTRING is actually doing anything.
1) Am I using the function incorrectly?
2) Is there a better way to do this? I really just need to get rid of the time portion of the variable from the date prompt.
Any help/guidance would be greatly appreciated. Spending too much time with trial and error approach.
Thanks,
BradBrad,
Try this way..In OBIEE RPD - Physical Layer for level 0 members in my Date dimension. Double click this member and check its type. Change the type to 'DATE' from 'DATETIME'. Delete the Date Dimension in BMM layer & Presentation Layer for again drag and drop from Physical Layer after changing the Type in physical layer.
Normal way of building the RPD using Essbase
Something similar to this http://www.rittmanmead.com/2009/03/dates-timestamp-and-oracle-bi-answers-filters/
This shud solve your timestamp problem everywhere. This is one of the most common problem for Oracle sources. I have essbase as a source but unfortunately I can't replicate it as this is not having time level.
Let me know if this solves your problem...
In case the type is DATE only in RPD then I'll try to provide a diff soln here.
Hope this helps -
Problem using JDBC and MS SQL Server
I got a problem trying to acces a database on my SQL Server. I created the table and my connection seems ok, but when i try to get some data from a table, this happens (see below).
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'players'.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3065)
at sun.jdbc.odbc.JdbcOdbcStatement.execute (JdbcOdbcStatement.java:338)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:253)
at Team.<init>(Team.java:18)
at Simulator.main(Simulator.java:5)
here's the code that i used to access the db with:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection
("jdbc:odbc:BRAIN2WINXPPJH","sm","sm");
Statement stm = conn.createStatement();
String query = "Select * from players where teamnr = " + nr +
" order by squadnr";
ResultSet rs = stm.executeQuery(query);
any help is more than welcome
tnx
JoIf all the tables are in the same database, you can use
Connection.setCatalog("db-name")
to change the current database. But the suggestion to include the database name in the SQL statement is safer, because you do not need to worry about changing the database at the right point.
Thomas -
Using User function in SQL*Loader
Hi, I have created the following control file. I am using DIRECT path insert. I am using a function to retrieve the column system_date. However, when I am running sql*loader, the fields system_date and load_date are loaded with null value.
OPTIONS (ERRORS=999999999, DIRECT=TRUE, ROWS=100000, SKIP=1)
LOAD DATA
INFILE 'Z:\xx.csv'
APPEND
PRESERVE BLANKS
INTO TABLE TB_RAW_DATA
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
REFERENCE_NUMBER,
SYSTEM_DATE "pkg_ken_utility.Fn_ken_get_param_value('SYSTEM_DATE','SYSTEM_DATE')",
LOAD_DATE "SYSDATE"
)No,
You can not call PL/SQL functions in DIRECT PATH mode, also this is documented, so you should not need to ask.
Sybrand Bakker
Senior Oracle DBA -
Using cursor function in sql statement
hi all
can anyone plss explain why and when we will use cursor function in a sql statement like this and what is the difference while executing this sql statement with cursor function in comparison of a simple sql statement----
select
department_name,
cursor (
select last_name
from employees e
where e.department_id = d.department_id
order by last_name
) the_employees
from departments d
thnx in advanceRTFM
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#sthref1452
Cheers
Sarma. -
Problem using webservice method consumer proxy with rawdata from abap
Hello Gurus,
I am struggling with an error using a proxy consumer service from ABAP. The proxy was generated using the WSDL from the web service provider. For a specific method we need to send a rawstring as seen bellow:
The file to be sent on this call is a ZIP file XAdES-BES signed and on BASE64. I’ve implemented the proper code to get the original file from local PC, and convert it to BASE64 before moving the content to the webservice structure and call the service proxy. At SOAMANAGER I also configured the webservice and the proper port with the WSDL:
The communication is working properly but my problem is with the binary content. When calling the webservice the response is that the structure of the file is wrong. I found it very strange since I used a tiny SOAPUI project with the same WSDL and it worked with no problem.
After debugging I could see that the content moved to the rawdata string before calling the proxy does not match the content that I can see from the call payload on web services util (srt_util)!
So the sample code for my method:
* get the file from the specified folder
call function 'GUI_UPLOAD'
exporting
filename = ld_zipfilename
filetype = 'BIN'
importing
filelength = zip_size
tables
data_tab = t_zip_data[]
exceptions
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
* convert to string
clear buffer_zip.
call function 'SCMS_BINARY_TO_STRING'
exporting
input_length = zip_size
importing
text_buffer = buffer_string
tables
binary_tab = t_zip_data[]
exceptions
failed = 1
others = 2.
* encode base 64
perform encode_base64 using buffer_string
buffer_zip.
form encode_base64 using in_string type string
out_string type xstring.
data: l_sbuff type string.
* convert the file to BASE64
call method cl_http_utility=>encode_base64
exporting
unencoded = in_string
receiving
encoded = l_sbuff.
call function 'SCMS_STRING_TO_XSTRING'
exporting
text = l_sbuff
importing
buffer = out_string
exceptions
failed = 1
others = 2.
endform. "encode_base64
calling the webservice:
l_input-xxxx-dokument = buffer_zip.
try.
call method l_proxy_test->webservice
exporting
input = l_input
importing
output = l_output.
catch cx_ai_soap_fault into lr_exc_soap_fault.
endtry.
From my understanding rawstring should be the same as ABAP xstring. If I debug the program and check the content of the l_input-dokument before calling the proxy I get binary content: “Izw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi04Ij8…” that is in fact correct
If I check the payload after call I can see that the binary content sent on the XML is not the same, in fact it is totally different: ”SXp3L2VHMXNJSFpsY25OcGIyNDlJakV1TUNJZ1pXNWpiMlJw…” !!
I’ve tried a lot of different conversions, changed configuration on the communication, port, etc and nothing seems to work. I really can’t figure out why the binary content on the call is not the same as I move to the webservice structure.
If I use the project from SOAP UI and send the proper binary content, that is “Izw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9InV0Zi04Ij8…” it works perfectly and the response is successfully.
Anyone has a clue what could be causing this?
Appreciate any kind of input.
Regards,
João Silva Pinto.Anyone? Any clue would be appreciated.
-
To use "analytic function" at "recursive with clause"
http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_10002.htm#i2077142
The recursive member cannot contain any of the following elements:
・An aggregate function. However, analytic functions are permitted in the select list.
OK I will use analytic function at The recursive member :-)
SQL> select * from v$version;
BANNER
Oracle Database 11g Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
SQL> with rec(Val,TotalRecCnt) as(
2 select 1,1 from dual
3 union all
4 select Val+1,count(*) over()
5 from rec
6 where Val+1 <= 5)
7 select * from rec;
select * from rec
ERROR at line 7:
ORA-32486: unsupported operation in recursive branch of recursive WITH clauseWhy ORA-32486 happen ?:|Hi Aketi,
It works in 11.2.0.2, so it is probably a bug:
select * from v$version
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
with rec(Val,TotalRecCnt) as(
select 1,1 from dual
union all
select Val+1,count(*) over()
from rec
where Val+1 <= 5)
select * from rec
VAL TOTALRECCNT
1 1
2 1
3 1
4 1
5 1 Regards,
Bob -
How to use percentage functions in BEx with structures
Hi, I need a help.
I have a query with a structure in the rows: two characteristics at left then the structure.
Plant, Year/Month and a structure with 3 lines (Line A = movement type = 1, 2, 3, Line B types 4, 5, 6, Line C types 7, 8, 9).
In the rows just a quantity.
I'm trying to use percentage functions CT or GT in the rows, but it's not working.
The idea is something like:
Plant 01 07/2010 Line A 30 30%
Line B 20 20%
Line C 50 50%
Result 33%
08/2010 Line A 40 20%
Line B 60 30%
Line C 100 50%
Result 66%.
When I do not use the structure percentage function works well, but with the structure results are completely wrong.
Any help will be appreciated.
César MenezesYou either have to use exception aggregation to give you the total per plant and use that in your percentage calculation, or you could define a formula in the cells. Here you can reference the specific cells you want to use as inputs.
Maybe you are looking for
-
XML Publisher errors with pdf template workd perfectly with rtf template
Hi there, I hope you are well. I am having a problem with pdf templates in XML publisher. I have a report which outputs XML, this works very well with an rtf template. However I am trying to create a pdf xml publisher template (using the concurrent p
-
Update of Camera Raw 7.2 for Photoshop CS6 and Lightroom 4.2 - now Bad color
Did the auto update of Camera Raw 7.2 to Photoshop CS6 and Lightroom 4.2 now the color is green and flat in all images after I save them. I do use a Nikon Camera profile and lens correction. Everything was working fine until the 7.2 update. Now the o
-
Font Families in Final Cut Pro not recognized
I was curious if there was a way to allow entire font families to appear in the text tool in Final Cut. Currently only the name of the family shows up and when it is seleced Final Cut seems to arbitrarily choose one of the fonts from the family to di
-
Trouble with migration software
HI there. I'e just switched over to iMac and trying to move files etc from my PC. after downloading the windows migration software, i get this message You can't open the application "WindowsMigrationAssistantSetup.exe" because Microsoft Windows appli
-
"Image Save As" not aviable because Contect Menu on right mouse click
Hi, I have a web report with a sheet and a graph. I would like to save the graph via right mouse click "Image Save As" but the IE menu is not available because the SAP menu is active on right mouse button. How can I activate the IE context menu? Rega