Basic PL/SQL parser usage?
First off, I have to say that the documentation (what little there is) for the pl/SQL XML parser is absolutely terrible. I've figured out the bulk of it through trial and error, and some examples, but I'm stuck on something very basic. How do I get the actual value from a node?<br>
How would I get "PROC_CODE_GUID5" from this node? <f>PROC_CODE_GUID_5</f>.<br> I try to use xmldom.getNodeValue(nodename), but it never returns any value.
Frank,
I'm sorry you had to go through the pains of figuring it out. I have been working with XML for a year now and have created a great website to help newcomers get started without the pain. The website is www.webspedite.com/oracle. Let me know what you think.
Regards,
Jason M Cohen
Similar Messages
-
Hi,
The Format SQL parser (up to latest 14.67) seems to have problems with certain characters (íìóò...), even though they're inside comments:
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
stop here
line 75:25: unexpected char: 0xF3
at oracle.dbtools.formatter.parser.PLSQLLexer.nextToken(PLSQLLexer.java:
773)
at oracle.dbtools.formatter.parser.PLSQLLexer.getNextToken(PLSQLLexer.ja
va:72)
at oracle.dbtools.formatter.PrettyPLSQL.format(PrettyPLSQL.java:66)
at oracle.dbtools.formatter.PrettyPLSQL.format(PrettyPLSQL.java:25)
at oracle.dbtools.sqlformatter.SQLFormatCommand.formatSQL(SQLFormatComma
nd.java:338)
at oracle.dbtools.sqlformatter.SQLFormatCommand.doit(SQLFormatCommand.ja
va:92)
at oracle.ide.controller.CommandProcessor$UndoStack.executeCommand(Comma
ndProcessor.java:819)
at oracle.ide.controller.CommandProcessor$UndoStack.doit(CommandProcesso
r.java:715)
at oracle.ide.controller.CommandProcessor$MasterStack.doit(CommandProces
sor.java:1004)
at oracle.ide.controller.CommandProcessor.invoke(CommandProcessor.java:1
78)
at oracle.dbtools.sqlformatter.SQLFormatter.executeCommand(SQLFormatter.
java:131)
at oracle.dbtools.sqlformatter.SQLFormatter.invoke(SQLFormatter.java:120
at oracle.dbtools.sqlformatter.SQLFormatter.handleEvent(SQLFormatter.jav
a:192)
at oracle.ide.controller.IdeAction.performAction(IdeAction.java:530)
at oracle.ide.controller.IdeAction$1.run(IdeAction.java:785)
at oracle.ide.controller.IdeAction.actionPerformedImpl(IdeAction.java:80
4)
at oracle.ide.controller.IdeAction.actionPerformed(IdeAction.java:499)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
49)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1
000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMen
uItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
read.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
I tried to evade the bug by making a selection of what I want to format, but the parser always starts at the beginning of the code. It's pretty incoherent that you make a selection, right-click on it for context-sensitive options, but then get results on the whole document. I would name it a bug: either disable (gray out) the functionality when there's a selection (indicating that's not supported right now), or do what the user expects to be done.
Could you please fix the parser bug and implement the selection-wise format feature?
TIA,
K.Barry,
Originally, I wanted to format a package made in another editor, having the indents horribly aligned.
The error I got is the one I mentioned: the 'ó' character inside a '--' comment.
Then I tried formatting only a selection of text, which also fails, as mentioned.
You can reproduce also in the SQL worksheet, also with other accentuated chars, and even in string values. For instance, try to format 'sELeCT 'testó' fROm DuaL;'.
Failing to format is probably a parser bug.
Formatting the whole pane instead of just the selected range of text is a flaw in application logic. If it's too hard to implement (or it gets low prio so it never gets fixed), I suggest disabling the entry when having made a selection. This would prevent the possibility of screwing up code when not being asked for.
Thanks for your interest!
K. -
Performance degradation in pl/sql parsing
We are trying to use xml pl/sql parser and noticed performance degradation as we run multiple times. We zeroed into the following clause:
doc := xmlparser.getDocument(p);
The first time the procedure is run the elapsed time at sqlplus is something like .45sec, but as we run repeatedly in the same session the elapsed time keeps on increasing by .02 seconds. If we log out and start fresh, we start again from .45sec.
We noticed similar degradation with
p := xmlparser.newParser;
but we got around by making the 'p' variable as package variable, initializing it once and using the same for all invocations.
Any suggestions?
Thank you.Can I enhance the PL/SQL code for better performance ? Probably you can enhance it.
or, is this OK to take so long to process these many rows? It should take a few minutes, not several hours.
But please provide some more details like your database version etc.
I suggest to TRACE the session that executes the PL/SQL code, with WAIT events, so you'll see where and on what time is spent, you'll identify your 'problem statements very quickly' (after you or your DBA have TKPROF'ed the trace file).
SQL> alter session set events '10046 trace name context forever, level 12';
SQL> execute your PL/SQL code here
SQL> exitWill give you a .trc file in your udump directory on the server.
http://www.oracle-base.com/articles/10g/SQLTrace10046TrcsessAndTkprof10g.php
Also this informative thread can give you more ideas:
HOW TO: Post a SQL statement tuning request - template posting
as well as doing a search on 10046 at AskTom, http://asktom.oracle.com will give you more examples.
and reading Oracle's Performance Tuning Guide: http://www.oracle.com/pls/db102/to_toc?pathname=server.102%2Fb14211%2Ftoc.htm&remark=portal+%28Getting+Started%29 -
Hey I'm trying to get a working understanding of some of the basics behind SQL, I've composed a few questions that I think may help me with this. Anyone that can help me with any of them will greatly help me thanks.
1. How to create synonym for tables?
2. How to describe the structure of tables?
3. How to list the contents of tables?
4. How to create a table named with the same structure as another table?
5. How to copy rows with less than a certain criteria in value (e.g. Price<$5.00) into another table?
6. How to change the data type to e.g. NUMBER(6)?
7. How to add a new column named with data type e.g. VARCHAR2(10)?
8. How to change a specific field within a table (e.g. For ORDER_NUMBER 12489, change the C_NUMBER to 315)?
9. How to delete a specific row from a table?
10. How to declare a column as the primary key of a table and call it e.g. PK_something?
11. How to show certain columns when another column is less than a certain criteria in value (e.g. Price<$5.00)?
12. How to show certain columns with another column having a certain item class e.g. HW or AP?
13. How to list certain columns when another column e.g. price is between two values?
14. How to list certain columns when another column e.g. price is negative?
15. How to use the IN operator to find certain columns (e.g. first and last name of customers who are serviced by a certain ID)
16. How to find certain columns when one of the columns begins with a particular letter (e.g. A)
18. How to list the contents of the a table sorted in ascending order of item class and, within each item class, sorted in descending order of e.g. price?
19. How to do a count of column in a table?
20. How to sum a column and make rename is something?
21. How to do a count of a column in a table (without repeats e.g. if a certain number repeats more than once than to only count it once)?
22. How to use a subquery to find certain fields in columns when the another column’s fields values are greater than e.g. its average price?848290 wrote:
Hey I'm trying to get a working understanding of some of the basics behind SQL, I've composed a few questions that I think may help me with this. Anyone that can help me with any of them will greatly help me thanks.To use the terminology you have in those questions, you must already have a basic understanding of SQL, so you have exposed yourself as not being the author of such questions.
Please do not ask homework questions without having at least attempted to answer them yourself first and show where you're struggling. -
Validating XML with PL/SQL parser
How can i validate a xml that is on a buffer with the grammar
stored in a BLOB column of o table? I'm using PL/SQL parser and
i can parse it correctly but i don't know how can i validate it
because my grammar is stored in DB.
nullAna Lucia (guest) wrote:
: How can i validate a xml that is on a buffer with the grammar
: stored in a BLOB column of o table? I'm using PL/SQL parser
and
: i can parse it correctly but i don't know how can i validate
it
: because my grammar is stored in DB.
You can't currently but this will be available in our next
release.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null -
Logging errors in PL/SQL Parser
Using PL/SQL Parser, is it possible to obtain the parsing errors
output in other place than a file (ref: setErrorLog function)?
as varchar variables or kind?
nullM Leclair (guest) wrote:
: Using PL/SQL Parser, is it possible to obtain the parsing
errors
: output in other place than a file (ref: setErrorLog function)?
: as varchar variables or kind?
It is not possible at this time. It has been filed as an
enhancement request.
Oracle XML Team
http://technet.oracle.com
Oracle Technology Network
null -
Does PL/SQL Parser Validate?
Just wondering if the PL/SQL parser can parse in validation mode?
I think I remember reading that the PL/SQL parser is a non-validating parser only but I didn't know if this changed.
Thanks for you helpI am also experiencing problems with the setDocumentType
This is my code
p := xmlparser.newParser;
xmlparser.parseBuffer(p,'<My_Data/>');
doc := xmlparser.getDocument(p);
docNode := xmldom.makeNode(doc);
xmldom.setVersion(doc, '1.0');
OuterNode := xmldom.getLastChild(docNode);
--Get DTD to parse against
xmlparser.setValidationMode(p,TRUE);
xmlparser.parseDTD(p,'c:\temp\v109.dtd','My_Data');
--Set DTD to validate against
docType := xmlparser.getDoctype(p);
xmlparser.setDoctype(p,docType);
xmlparser.freeParser(p);
The problem I am having is that the output now looks like this
<?xml version="1.0" encoding="UTF-8"?>
<My_Data>
</My_Data>
<!DOCTYPE My_Data SYSTEM "file:/c:/temp/v109.dtd">
The xmlparser.parseDTD requires as the third parameter the root element so the !DOCTYPE field comes after the root element and not before as required.
Hope this code helps a bit and if you solve the problem please let me know
Owen
null -
Hi,
I am developing a logging framework, where applications which are initiating PL/SQL transactions also log the same using our framework. The reason being, the application owner can then analyze data from these logs. I was wondering whether there is something in existence like the "General SQL Parser" for a linux based c++ component, so that we can parse the PL/SQL blocks and represent the data in a certain format.
Are there any ORACLE libraries that I can use, which would work with PYTHON or any other scripting languages and parse the PL/SQLs albeit out of the scope of the ORACLE DB itself.
Do let me know,
cheers,
jagsOur logging framework is a generic c++ framework, where applications have a 2 stage approach
1) Execute the SQL transaction to their DB host.
2) The same SQL transaction is then logged to our framework (non DB), we then generate reports on these SQL transactions.
We are already handling parsing the log data for the SQL commands but need something for the PL/SQL blocks. -
Hi,
I have to create a parser for PL/SQL 8i.
Any help on what to start with would be very helpful.
I hope to use the EBNF rules for the parsing. Am I in the right direction?
Are there any open source code for PL/SQL parser ?
Thanks & Regards
Aswin AsokanHi,
I have to create a parser for PL/SQL 8i.
Any help on what to start with would be very helpful.
I hope to use the EBNF rules for the parsing. Am I in the right direction?
Are there any open source code for PL/SQL parser ?
Thanks & Regards
Aswin Asokan The direction is right as far as I know but the task
is really difficult. PL/SQL's syntax is inherited
from ADA language which is BIG one and very complex to parse.
And there is SQL part as well. Just look at the
market - so few products are based on this kind
of parser (PL/SQL) - as I can guess.
For example:
Formatter Plus (www.quest.com),
ClearSQL (www.clearsql.com),
CAST PL/SQL Analyzer (www.castsoftware.com),
LECCO SQL Expert for Oracle (www.leccotech.com ) - as I can assume but I'm not sure.
Probably you may search the net for a little subset of this
parser - for ANSI SQL or for ADA to start with. -
PL/SQL parser for 7.3 DB?
We have an ORACLE 7.3 DB and are looking for a PL/SQL parser for XML... Some of the posts I've seen seem to suggest that a solution exists, but I'm not having any luck finding out for sure...
Thanks,
Jeffhttp://technet.oracle.com/tech/xml/info/index2.htm?Info&plsxml/xml4plsql.htm
-
Hi,
just came across a strange PL/SQL parser behavior. Why is the following PL/SQL code valid?
DECLARE
vEmpNo NUMBER;
BEGIN
FOR rEMP IN
( SELECT EMPNO
INTO vEmpNo
FROM EMP
LOOP
dbms_output.put_line('Value: '||vEmpNo);
END LOOP;
END;The "INTO vEmpno" doesn't make much sense, but it's successfully compiled and executed.
Database version is 10.2.0.3.0
Any idea?
Patrick
My APEX Blog: http://www.inside-oracle-apex.com/
The APEX Builder Plugin: http://builderplugin.oracleapex.info/
The ApexLib Framework: http://apexlib.sourceforge.net/the pl/sql manual gives the syntax of a cursor for loop as
cursor_for_loop_statement ::=
[<< label_name >>] FOR record_name IN
{cursor_name [(cursor_parameter_name
[, cursor_parameter_name]...,)]
| (select_statement)}
LOOP statement [statement]...
END LOOP [label_name];and the pl/sql manual defines a "select into" as
"The SELECT INTO statement retrieves data from one or more database tables, and assigns the selected values to variables or collections. For a full description of the SELECT SQL statement, see Oracle Database SQL Reference."
and it also says
"Selecting At Most One Row: SELECT INTO Statement
If you expect a query to only return one row, you can write a regular SQL SELECT statement with an additional INTO clause specifying the PL/SQL variable to hold the result."
so, if pl/sql feels that the INTO is just another clause to a regular select statement, and cursor-for-loops work on select statements, then there is no problem. huh?????
guess in a similar way to v8 pl/sql allowing select of booleans, it just ignores that clause. but since it isn't explicitly stated as being allowed, we can hope that oracle will eventually notice and get rid of it. -
PL/SQL parser installation error
I tried to install the XML PL/SQL parser against Oracle 8.1.6 with JServer Release 8.1.6.0.0 and I received a large number of errors about invalid column names including the following:
Error while resolving class oracle/xml/parser/v2/FromDescendantAttributes
ORA-00904: invalid column name
Error while resolving class oracle/xml/parser/v2/XSLNode
ORA-00904: invalid column name
Error while resolving class oracle/xml/parser/v2/UnaryExpr
ORA-00904: invalid column name
Any suggestions?
ThanksHi Steven:
Yep...I just checked our install and there are no java classes in user_objects. We had the init*.ora file shared_pool_size set too low (as indicated under $ORACLE_HOME/javavm/doc/readme.txt).
So I'll get our DBA to try it again.
Thanks,
Derek
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
This likely means that the database JavaVM is not properly installed in your Oracle8i database. You need to run the initjvm.sql script as detailed in the JServer documentation before any 'loadjava'
commands will work.<HR></BLOCKQUOTE>
null -
Deleting old data won't reduce Windows Azure SQL Database usage
My Windows Azure SQL Database usage keeps increasing. Deleting old data didn't help much. I was wondering how to figure out the distribution of the usage. All tables in my DB should not occupy more than 5GB and now it is most 12GB. Please help!
http://yanflex.comHello,
The database fee is amortized over the month and charged daily. The daily fee depends on the peak size that each database reached that day and the maximum number of databases you use. So, if the peak size of database is 12 GB and then you delete data
to reduce the size, it still charge based on 12GB this day.
You can use the following statement to get the database size:
SELECT SUM(reserved_page_count)*8.0/1024 as DBsizeinMB
FROM sys.dm_db_partition_stats;
Reference:Accounts and Billing in Windows Azure SQL Database
Regards,
Fanny Liu
If you have any feedback on our support, please click here.
Fanny Liu
TechNet Community Support -
Sql memory usage increase each time win app runs
Hi,
Sql memory usage increases each time when win app runs. Why does it work like this? Is it normal ?
I restart SQL Server 2012. Only my win app uses SQL server.
First run of winapp.
start memory usage : 211.800 KB
close memory usage: 528.136 KB
Second run of xaf app.
start memory usage : 528.136 KB
close memory usage: 996.844 KB
Third run of xaf app
start memory usage : 996.844 KB
close memory usage: 997.640 KB
Fourth run of xaf app
start memory usage : 997.640 KB
close memory usage: 1.104.864 KBHi,
Sql memory usage increases each time when win app runs. Why does it work like this? Is it normal ?
Yes, it is perfectly normal for SQL Server to acquire and hold onto large amounts of memory indefinitely. This memory improves performance by avoiding disk I/O, query plan compilation and costly memory management.
On a dedicated SQL Server you should usually let SQL Server dynamically manage memory. It will release memory if it detects memory pressure. But if you often run other applications on the server than need significant amounts of memory (e.g. IIS,
application services), you may want to set max server memory as suggested.
Dan Guzman, SQL Server MVP, http://www.dbdelta.com -
Hello
I am updating some items with the DTW. i am updating 9000 items. I have made 9 files of 1000 records, i am just updating the picturname field. When i start to upload the files the SQL Memory usage starts to grow more and more. When i try to upload the third file the memory has grown too much, and the DTW says the file update ok but it doesnt update the database. So i need to restart the SQL service (mssqlserver) and do it again. Some times it doesnt work so i need to restart the server.
Any ideas??
Jacobohi,
Check this information abt DI API Memory Consumption in WIKI SDK FAQ's.
https://www.sdn.sap.com/irj/scn/wiki?path=/display/b1/faq_sdk
DI API
Memory consumption
New connection mechanism in 2007 vs. classical
1. In the old method the DI API was loaded into the same process with the Add-On and was an "actual part" of it, so calls to the DI-API were very quick and direct
2. In the new method there is one common DI-API which is part of the Core B1. All the Add-Ons will use the same DI-API IF (!!!) they work in the new method. The calls to the DI-API have now to "go between" two processes. This means that they go through more processing and although it's all in the same machine and no actual communication (i.e., network traffic) is actually happening, the system's CPU and memory are "working harder".
The impact is extremely small on an individual call level, but for an Add-On that makes a large amount of calls this difference accumulates...
There is no huge additional CPU or Memory consumption. Most of the impact is on the Response Time level. Some of it is CPU consumption and some of it is Context Switch waiting.
3. This trade-off between Memory consumption and Response Time is actually another reason why R&D thought it's a good idea to leave the new method to be optional based on a decision from the developer.
Jeyakanthan
Maybe you are looking for
-
Apple TV + External Hard Drive + Network
I have bought an external hard drive and will consolidate my iTunes library onto it (as it's been cramping my ATV and MacBook's collective capacity). Simple question - if I run my iTunes library exclusively from my external hard drive and plug it int
-
Problem accessing iPlanet with Firewall
We have iPlanet 4.1 SP9 webserver installed in Solaris 8. The server is configured with IP address 10.98.23.17. We are able to access our JSP web application successfully thru intranet without any firewall. But, we face problems while accessing with
-
Changed info in iTunes does not save
I change the info on songs or albums and iTunes, but iTunes does not save the changes the next time I open iTunes
-
Quarter End date duplicate value issue in pivot
Hi gurus, I have a requirement to show the working hours and utilization of an employee. I have these three fields Employee Name Week Start Date Year (Based on Week Start Date) Quarter (Based on Week Start Date) Effort Logged Date(Date in which
-
The icon problem happened to me and after trying everything I put it in a Apple dealer. Is this type problem included in the Warranty? The product just had 3 weeks and it stoped working properly. The dealer says I have to pay the repair. Thank you.