SQL parser bug?

Is there a known problem with NOT IN operator? The following statement returns "no rows selected" message
SELECT col_a FROM tab_a WHERE col_a NOT IN (
SELECT col_b FROM tab_b);
while the following two statements both return the expected result
SELECT col_a FROM tab_a MINUS SELECT col_b FROM tab_b;
SELECT col_a FROM tab_a WHERE NOT EXISTS (
SELECT * FROM tab_b WHERE col_b = tab_a.col_a);
Note 1: This failure only happens on certain tables, but not on other tables in the same database.
Note 2: both of tab_a.col_a and tab_b.col_b are VARCHAR2(32).
Note 3: Oracle8.1.7 on Tru64.
Any insights are appreciated.
Robin

My first instinct is that it has to do with handling nulls. Each of those statements will do it slightly differently.
col_a NOT IN () : if col_a is null won't return row
MINUS : Oracle will correctly compare nulls
NOT EXISTS ( = col_a) : if col_a is null won't return row so 'not exists' will be true and master query row will always return row (even if they were both null).
Have you checked that?
Richard

Similar Messages

  • PL/SQL Parser Bug?

    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.

  • SQL Parsing Bug in Oracle SQL Analyze in 9i

    The following does not work in SQL Analyze on 9i:
    select extract(HOUR from to_TIMESTAMP('2003-02-28 13:00:00','YYYY-MM-DD HH24:MI:SS')) FROM DUAL;
    It complains at there being two "from" in the SQL.
    As I'm new to OTN is there a fix for this bug and is it listed in a bug tracker?
    Thanks

    Hi Rodrigo,
    Thank you for reporting this. The only bug I see currently logged on a comment affecting the generated View DDL involves ending the last line of the definition with a comment, which treats the ending semi-colon (even if on a different line) as part of the comment. That is actually related to a low-priority bug against an Oracle database API.
    Unfortunately, your pseudo-code is a bit complex. Trying a few quick, simpler tests against the standard HR schema did not reproduce the issue. I tried INNER JOIN, and nested SELECTs. It would help greatly if you could provide a test case compilable against one of the standard schema, like HR or SCOTT.
    Regards,
    Gary
    SQL Developer Team

  • Format SQL parser issues

    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

  • 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.
    null

    Ana 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?
    null

    M 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 help

    I 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

  • PL/SQL Parser engine

    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,
    jags

    Our 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.

  • PL/SQL parser creation

    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 Asokan

    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 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,
    Jeff

    http://technet.oracle.com/tech/xml/info/index2.htm?Info&plsxml/xml4plsql.htm

  • 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?
    Thanks

    Hi 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

  • Another SQL Developer bug - End of file in comment

    I found another SQL Developer bug in version 3.0.0.4.
    If I try to compile some package from file (so I open file with package body in SQL Developer and assign it to some connection) with this kind of comment: /* comment */ behind end of package, I get this error
    I got Error(1250,28): PLS-00111: end-of-file in commentFunny is, that when the package is compiled directly from the database - it works.
    When I try to compile the package from file with this kind of comment --comment behind the end of package, it also works...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hi, I think I finally got it. This looks like an ugly fat bug :)
    First, we are not using the .sql extensions. For package specification - we use .pks. For package body - we use .pkb.
    Create this script:
    CREATE OR REPLACE PACKAGE TEST_xxx AS
    PROCEDURE TEST_PROCEDURE;
    END TEST_xxx; /*0123456789*/Now save this as e.g. "TEST.pks" file. Open this file in SQL Developer and compile it. You will get the "Error(3,27): PLS-00111: end-of-file in comment".
    Now look at the result in the database -> Open the package specification from the database and you see this:
    create or replace
    PACKAGE TEST_xxx AS
    PROCEDURE TEST_PROCEDURE;
    END TEST_xxx; /*0123456789*The last slash is missing...
    Now go back to the file with the package specification and delete one letter from the comment. Compile it again... it works now.
    It looks like the length of this kind of comment is limited to 9 characters.
    The limitation is there only when:
    1) Compiling from file with different extension than .sql !!! If you rename the file to "TEST.sql", SQL Developer opens it as a script file and runs it as a script, so there is no problem with it.
    2) It has to be this kind of comment: /* */. One line comments are not limited.

  • Sybase ESP java sdk, SQL parser exception for all queries

    Hi,
    I am new to Sybase ESP java sdk. Trying to use sdk projection subscription, but getting for all the queries including blank string:-
    com.sybase.esp.sdk.exception.ProjectErrorException: SQL parsing error
    at com.sybase.esp.sdk.impl.SubscriberImplV3.doSubscribe(Unknown Source)
    at com.sybase.esp.sdk.impl.SubscriberImpl.subscribeSql(Unknown Source)
    My Example code :-
    Credentials creds = new Credentials.Builder(Credentials.Type.USER_PASSWORD).setUser("user").setPassword("pwd").create();
      Project project = s_sdk.getProject(uri, creds);
      project.connect(WAIT_TIME_60000_MS);
      Subscriber subscriber = project.createSubscriber();
      //subscriber.subscribeStream("Trades");
      subscriber.connect();
                    subscriber.subscribeSql("select UserMaxCpu from wSBW912");
    I am new to sdk and not sure what I am doing wrong here, please suggest.
    Thanks,
    Venkatesh

    The problem you're experiencing is due to your JNDI configuration not matching the JavaDB database where you created the tables.
    If you look at the config for DerbyPool in the Admin Console, you'll see that DerbyPool points to:
    jdbc:derby://localhost:1527/sun-appserv-samples
    In the Admin Console click Resources->Connection Pools->DerbyPool, then click Additional Properties (9.1) or look at the page (9.0).
    You can either modify DerbyPool's config to point to:
    jdbc:derby://localhost:1527/BookDB
    Or you can create the tables in sun-appserv-samples. The create-tables ant task included with the Java EE 5 Tutorial will create the tables in the correct database.
    -ian

  • SQL Parser supporting nested queries

    Hi,
    I require a SQL parser that supprt nested queries. JavaCC doesnt support nested queries so that one is out. If anyone knows of any open sourse parser, please enlighten me. I have already looked enough on Google but not of much use.
    thanks,
    abulkd

    | 1. as suggested , i was able to get the oraclexmlsql.jar
    | from the servlet zip and loading it solved the problem of
    | the jdbc string being printed int he cursor syntax . it
    | works from the xmlgen utility withing pl/sql. but when
    | using OracleXML in a java prog the results still printout
    | the jdbc string.. any ideas...
    Could only be a CLASSPATH problem difference in your two
    tests.
    | 2. Is there anyway to supress the rownum attribute tag in
    | the subquery (cursor) results...that is the
    | setRowIdAttrName .... w/o using xslt
    Not at this time. Rownum supression on the subquery should
    probably follow your settings on the main query. I'll
    suggest to the devs.
    | 3. We are implementing a solution using these tools.... we
    | wanted to know which were the production versions.
    XDK Components for XML and XSLT are production.
    XML SQL Utility and XSQL Servlet are still Technical
    Previews and as such are not yet production.
    null

Maybe you are looking for

  • Registering my new Macbook Pro through Apple?

    How could I go about registering my new Macbook Pro through Apple. Is there any special way to do so because the first day I turned it on I remember typing in some sort of information but was not sure if it was to register it, thanks so much; cheers

  • How to use Function Module of Appraisal

    Hi, I want to use the standard Function Module for Appraisal like HRHAP_DOCUMENT_GET_DETAIL. But how to use it. What is the procedure to use standard function module.

  • Change default setting for "Repeat All Songs on Album"

    It seems that the default setting for my iPod Touch is to play all songs on the album, then repeat at track one of the same album. It is easy enough to shut this option off while playing the music, but I was wondering if there was a way to set the de

  • "Missing initial moveto in path definition" displayed on console

    Hello - I have an AreaChart using all default styles...nothing is being done from my end to it as far as css/styles. I see this message on the console "Missing initial moveto in path definition. Path: Path@fe315d[styleClass=chart-series-area-fill ser

  • Create a playlist for the QT player....

    Is it possible to have a playlist to upload video to a QT player? I would like to have a few video listed in one player. I would rather have a list then individual icons on a page. Here is a player that does what I would like QT to do. Does QT do thi