OWB 10.2.0.4 ANSI SQL join problem

Hi
Its seams to me, that in OWB 10.2.0.4 there is something broken with ANSI SQL joins and instead of ANSI joins there is used oracle SQL joins only. Maybe someone can point some solutions? I can’t rewrite all mappings with union and other operators. And manually pl/sql editing also would be big problem.

"Am I correct in assuming you did not code ANSI joins?" -> yes, i am coding Oracle SQL joins and with this option just generating ANSI joins.
With ANSI SQL join you can use OR and IN operands (and code looks more readable).
It is question of performance (so for example 80% of dataset you can join by one column other 15% by second etc ..). So this all can be rewritten also in Split->join->union all, but if you have several such joins, this will be painfully.

Similar Messages

  • ANSI SQL JOIN

    Hi
    How to use ANSI SQL JOINS (9i) for below query
    SELECT EMP.EMPNO,EMP_T.TNO,EMP_T.SAL1 FROM EMP,EMP_T WHERE EMP.EMPNO=EMP_T.TNO
    UNION ALL
    SELECT EMP.EMPNO,EMP_T.TNO,EMP_T.SAL2 FROM EMP,EMP_T WHERE EMP.EMPNO=EMP_T.TNO
    UNION ALL
    SELECT EMP.EMPNO,EMP_T.TNO,EMP_T.SAL3 FROM EMP,EMP_T WHERE EMP.EMPNO=EMP_T.TNO
    EMPNO TNO SAL1
    7369 7369 100
    7499 7499 1000
    7566 7566 400
    7782 7782 4000
    7369 7369 200
    7499 7499 2000
    7566 7566 500
    7782 7782 5000
    7369 7369 300
    7499 7499 3000
    7566 7566 600
    EMPNO TNO SAL1
    7782 7782 6000
    Regards
    MM

    SELECT EMP.EMPNO,
           EMP_T.TNO,
           EMP_T.SAL1
    FROM   EMP
    JOIN   EMP_T ON ( EMP.EMPNO = EMP_T.TNO )
      UNION ALL
    SELECT EMP.EMPNO,
           EMP_T.TNO,
           EMP_T.SAL2
    FROM   EMP
    JOIN   EMP_T ON ( EMP.EMPNO = EMP_T.TNO )
      UNION ALL
    SELECT EMP.EMPNO,
           EMP_T.TNO,
           EMP_T.SAL3
    FROM   EMP
    JOIN   EMP_T ON ( EMP.EMPNO = EMP_T.TNO )

  • Converting oracle join to Ansi sql join

    Hi Guys,
    I am new to SQL and trying to convert the following Oracle query (joins) into ANSI sql joins...Can someone please help me?
    SELECT M.EXTERNALCODE, M.NAME AS MNAME, SC.BIRIM, SM.TRANSACTIONDATE, SMD.AMOUNT,
    SMD.UNITPRICE, SM.ID AS SMID, SMD.ID AS SMDID, F.NAME AS FNAME,
    IFNULL (SMD.AMOUNT, 0, SMD.AMOUNT) * IFNULL (SMD.UNITPRICE, 0, SMD.UNITPRICE) AS TOTALPRICE, SMD.AMOUNT AS RECEIVED_QUANTITY,
    PD.ORDERID, PD.AMOUNT QUANTITY, PO.PROCESSDATE
    FROM STOCKMAINTRANSACTION SM,
    STOCKMAINTRANSACTIONDETAIL SMD,
    MATERIAL M,
    STOCKCARD SC,
    FVSTOCK FVS,
    FIRM F,
    PURCHASEORDER PO,
    PURCHASEORDERDETAIL PD,
    PURCHASEORDERDETAILSUPPLIED PDS
    WHERE SM.ID = SMD.MAINTRANSACTIONID
    AND SMD.MATERIALID = M.ID
    AND SMD.STOCKCARDID = SC.ID
    AND SM.PROPREF = FVS.RECORDID(+)
    AND FVS.FIELDID(+) = 2559
    AND FVS.FLEVEL(+) = 'F'
    AND F.ID(+) = SUBSTR (FVS.FVALUE, 1, 9)
    AND SM.TRANSDEFID in (999,2329,2344,2370,150000903,150005362)
    AND SMD.CANCELLED = 0
    AND SMD.STOCKUPDATED = 1
    AND SMD.ID = PDS.STOCKMAINTRANSACTIONDETAILID
    AND PDS.ORDERDETAILID = PD.ORDERDETAILID
    AND PO.ORDERID = PD.ORDERID
    AND (M.ID = {@MATERIALID@} OR {@MATERIALID@} = 0)
    AND (SM.STOREID = {@STOREID@} OR {@STOREID@} = 0)
    AND (F.ID = {@SUPPLIERID@} OR {@SUPPLIERID@} = 0)
    AND SM.TRANSACTIONDATE BETWEEN {@STARTDATE@} AND {@ENDDATE@}
    ORDER BY F.NAME, M.EXTERNALCODE, SM.TRANSACTIONDATE
    Really appreciate the help!
    Thanks.

    Hi,
    Welcome to the forum!
    To convert to ANSI syntax, replace join conditions in the WHERE clause
    FROM           x
    ,             y
    WHERE         x.x1  = y.y1
    AND           x.x2  = y.y2with ON conditions in the FROM clause:
    FROM           x
    JOIN             y   ON    x.x1  = y.y1
                             AND   x.x2  = y.y2In inner joins, conditions that do not reference 2 tables are not really join conditions, so it doesn't matter if they are in the FROM clause or in the WHERE clause.
    In your case
    SM.TRANSDEFID in (999,2329,2344,2370,150000903,150005362)could be part of a join condition involving sm, or it could be in the WHERE clause. Most people find it clearer if 1-table conditions like this are in the WHERE clause.
    Again, this only applies to inner joins. For outer joins, all conditions that apply to a table that may lack matching rows must be included in the FROM clause, like this:
    LEFT OUTER JOIN  fvstock   fvs  ON   sm.propref       = fvs.recordid
                                    AND  fvs.fieldid  = 2559
                        AND  fvs.flevel   = 'F'Try it.
    If you have trouble, post your best attempt, along with CREATE TABLE and INSERT statements for a little sample data from all the tables involved, and the results you want from that data. Simplify the problem. Post only the tables and columns that you don't know how to handle.
    See the forum FAQ {message:id=9360002}
    user8428528 wrote:
    AND (M.ID = {@MATERIALID@} OR {@MATERIALID@} = 0)
    AND (SM.STOREID = {@STOREID@} OR {@STOREID@} = 0)
    AND (F.ID = {@SUPPLIERID@} OR {@SUPPLIERID@} = 0)
    AND SM.TRANSACTIONDATE BETWEEN {@STARTDATE@} AND {@ENDDATE@}This is not valid Oracle SQL. Is {@MATERIALID@} some kind of variable?

  • Having SQL join problems!

    I have got a master recordset and this is the SQL for it:
    SELECT fld_contentID, fld_contentPAGE, fld_contentIMGSLDR, fld_contentTITLE, fld_contentTOP, fld_contentPODL, fld_contentPODR, fld_contentBOTTOM, fld_contentBGIMG, fld_contentSHOW, fld_contentDATE
    FROM tbl_content
    WHERE fld_contentPAGE = '1'
    ORDER BY fld_contentDATE DESC
    This works fine. I can populate the page with the content that I want.
    I have a second table with secondary information within it for promotional needs. This table serves what I am referring to as 'pods' of info. I am trying to pull and join content from the table called tbl_pods using the unique ID of the pod record and joining it with a field in the tbl_content table, and that field is called fld_contentPODL. Here's the code:
    SELECT *
    FROM tbl_pods
    JOIN tbl_content ON tbl_content.fld_contentPODR = tbl_pods.fld_podID
    WHERE fld_podID = podrvar
    Name: podrvar
    Type: Interger
    Default value: %
    Run-time Value: $_GET['tbl_content.fld_contentPODL']
    I have tried every variation of JOIN that I can think of, but it just won't work with a dynamic default value. If I give a specific default value of 1, instead of %, then it works as expected, but only by being specific which means it's not loading the variable dynamically.
    Can somebody please highlight the problem with my join statement, cos this is driving me mental!
    Is there something wrong with my master table tbl_contents. I can't see that there is as I am using the field fld_contentPODL to hold the unique ID of the pod, so surely I can join the tables on that! Am I passing data incorrectly? I didn't think I was as I am asking to join the data of tbl_pods to the data of tbl_contentPODL, which should work.
    Thanks in advance.
    Mat

    What I mean by dynamic default value is the content of the field in the record which is effectively the 'master' instruction to load the content of the JIONed table record using the field fld_podID (in tbl_pods). Basically, as you put it, the runtime value. I used % as an example just because I have tried loads of other things! I normally use -1 which DW sets by default.
    So, my database is like this:
    Main page content is held in a table called: tbl_content
    fld_contentID - INT (primary key) - Value eg: 1 to what ever!
    fld_contentTITLE - VARCHAR - Value eg: About us
    fld_contentTOP - VARCHAR - Value eg: Blah blah blah
    fld_contentPODL - INT - Value eg: 1 (or 2 or 3 etc based on how many records I have in tbl_pods.fld_podID)
    The 'pods' content is held in a table called: tbl_pods
    fld_podID - INT (primary key) - Value eg: 1 to what ever!
    fld_podNAME - VARCHAR - Value eg: Book for Xmas
    fld_podCONTENT - VARCHAR - Value eg: We're taking bookings now, so get in touch to ensure you don't miss out.
    What I am trying to do is JOIN tbl_content.fld_contentPODL to tbl_pod.fld_podID and then display the runtime content associated with the record so I can display 'Book for Xmas, We're taking bookings now...'
    Here's my page code:
    <?php require_once('Connections/conn_t3pi.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    mysql_select_db($database_conn_t3pi, $conn_t3pi);
    $query_rs_content = "SELECT * FROM tbl_content WHERE fld_contentPAGE = '1' ORDER BY fld_contentDATE DESC";
    $rs_content = mysql_query($query_rs_content, $conn_t3pi) or die(mysql_error());
    $row_rs_content = mysql_fetch_assoc($rs_content);
    $totalRows_rs_content = mysql_num_rows($rs_content);
    $podlvar_rs_podl = "-1";
    if (isset($_GET['tbl_pods.fld_podID'])) {
      $podlvar_rs_podl = $_GET['tbl_pods.fld_podID'];
    mysql_select_db($database_conn_t3pi, $conn_t3pi);
    $query_rs_podl = sprintf("SELECT * FROM tbl_pods JOIN tbl_content ON tbl_content.fld_contentPODL = tbl_pods.fld_podID WHERE tbl_content.fld_contentPODL = %s", GetSQLValueString($podlvar_rs_podl, "int"));
    $rs_podl = mysql_query($query_rs_podl, $conn_t3pi) or die(mysql_error());
    $row_rs_podl = mysql_fetch_assoc($rs_podl);
    $totalRows_rs_podl = mysql_num_rows($rs_podl);
    ?>
    <!DOCTYPE HTML>
    <html>
    <head><title>Untitled Document</title></head>
    <body>
    <h1 class="pinyon"><?php echo $row_rs_content['fld_contentTITLE']; ?></h1>
        <?php echo $row_rs_content['fld_contentTOP']; ?>
        <p><a href="http://localhost/~matthewstuart/ThreePigeons/page.php?ID=1">link</a></p>
      <h4><?php echo $row_rs_podl['fld_podNAME']; ?></h4>
      <p><?php echo $row_rs_podl['fld_podCONTENT']; ?></p>
    </body>
    </html>
    <?php
    mysql_free_result($rs_content);
    mysql_free_result($rs_podl);
    ?>
    I've made the SQL bold so it's easier to pick out. Yeah, I am at a loss as I can make the correct content appear if I physically type the correct runtime ID, but if I have a runtime that is loaded by the master record, then it doesn't show anything. I can't figure out why! I am sure I just have something switched around either in the JOIN or in the WHERE, but I don't know what though.
    Thanks.
    Mat

  • SQL JOIN problem

    Hello,
    To output data on my .php website I use a SQL database. One
    particular page needs information from 3 tables:
    1. Product (product.id, product.name)
    2. Partner (partner.productid, parner.shopname)
    3. Shop (shop.shopshopname)
    I currently have this code running to make it happend:
    SELECT *
    FROM (product LEFT JOIN partner ON product.id =
    partner.productid) LEFT JOIN shop ON partner.shopnaam =
    shop.shopshopnaam
    WHERE product.categorie = 'Kinderwagens' AND
    product.hoofdmodel = '1'
    ORDER BY product.name ASC, shop.shopcpc DESC
    The idea is that every product.name gets outputted in a list
    just once and that it picks partner.productid of the row with the
    highest corresponding shop.cpc.
    Example: I have a lot of product.id's where product.id =
    "1000 is found 4 times in partner.productid. All product.name's are
    outputted and ascend correctly. However, product.name with
    product.id=1000 is outputted 4 times. I only want it outputted once
    where it pickes the corresponding partner.id where its
    corresponding shop.shopcpc is highest. What do I do to prevent it
    from outputting all 4?
    I know its kind of complex to explain, if there are questions
    please let me know.

    I kind of fixed this problem with a group by:
    SELECT *
    FROM (product LEFT JOIN partner ON product.id =
    partner.productid) LEFT JOIN shop ON partner.shopnaam =
    shop.shopshopnaam
    WHERE product.categorie = 'Kinderwagens' AND
    product.hoofdmodel = '1'
    GROUP BY product.naam
    ORDER BY product.naam ASC, shop.shopcpc DESC
    However, by doing this my ORDER BY shop.shopcpc doesnt work
    anymore. Anyone know how to fix this?

  • ANSI SQL 92 SYNTAX OUTER JOIN PERFORMANCE ISSUE

    Good Morning
    Could anyone explain why the excution time for these two (ment to be identical)
    queries run so differently.
    oracle syntax execution time 1.06 seconds
    select COUNT(*) from
    PL_EVENT_VIEW pev,
    PL_EVENT_STAFF_VIEW pesv
    WHERE pev.EVENT_ID=PESV.EVENT_ID(+)
    AND pev.WEEKS=PESV.WEEK_NUM(+)
    AND pev.event_id=2520
    ansi sql 92 syntax execution time 7.05 seconds
    select COUNT(*) from
    PL_EVENT_VIEW pev
    LEFT JOIN PL_EVENT_STAFF_VIEW pesv
    ON (pev.EVENT_ID=PESV.EVENT_ID
    AND pev.WEEKS=PESV.WEEK_NUM)
    WHERE pev.event_id=2520
    Thanks
    David Hills

    BTW Oracle outer join operator (+) and ANSI SQL OUTER JOIN syntax are NOT equivalent. Consider following:
    DROP TABLE T1;
    CREATE TABLE T1 (C1 NUMBER);
    DROP TABLE T2;
    CREATE TABLE T2 (C2 NUMBER);
    DROP TABLE T3;
    CREATE TABLE T3 (C3 NUMBER);
    -- Following SELECT works:
    SELECT COUNT(*)
         FROM T1, T2, T3
         WHERE C2 = C1
              AND C3(+) = C1
    COUNT(*)
    0
    -- But:
    SELECT COUNT(*)
         FROM T1, T2, T3
         WHERE C2 = C1
              AND C3(+) = C1
              AND C3(+) = C2
    AND C3(+) = C1
    ERROR at line 4:
    ORA-01417: a table may be outer joined to at most one other table
    -- However with ANSI syntax:
    SELECT COUNT(*)
         FROM T1
         JOIN T2 ON (C2 = C1)
         LEFT JOIN T3 ON (C3 = C1 AND C3 = C2)
    COUNT(*)
    0

  • ANSI SQL Syntax - What belongs to join-clause and what to where-clause

    Hello,
    we currently have a discussion about the ANSI SQL Syntax where we do not agree what belongs to the join clause and what belongs to the where clause in an ANSI Sytnax SQL Query.
    Lets say there is a query like this:
    +SELECT *+
    FROM employees emp, departments dept
    WHERE emp.dept_country = dept.dept_country
    AND emp.dept_name = dept.dept_name
    AND dept.dept_type = 'HQ'
    AND emp.emp_lastname = 'Smith'
    Primary key of the departments table is on the columns dept_country, dept_name and dept_type. We have a Oracle database 10g.
    Now I have rewritten the query to Ansi Syntax:
    +SELECT *+
    FROM employees emp
    JOIN departments dept
    ON emp.dept_country = dept.dept_country AND emp.dept_name = dept.dept_name
    WHERE dept.dept_type = 'HQ'
    AND emp.emp_lastname = 'Smith'
    Another developer says that this is not completely correct, every filter on a column that belongs to the primary-key of the joined table has to be in the join clause, like this:
    +SELECT *+
    FROM employees emp
    JOIN departments dept
    +ON emp.dept_country = dept.dept_country AND emp.dept_name = dept.dept_name AND dept.dept_type = 'HQ'
    WHERE emp.emp_lastname = 'Smith'
    Can somebody tell me which on is correct?
    Is there any definition for that? I couldn't find it in the Oracle Database definition.
    I just found out the names of the ANSI documents here: http://docs.oracle.com/cd/B19306_01/server.102/b14200/ap_standard_sql001.htm#i11939
    I had a look at the ANSI webstore but there you have to buy the PDF files. In my case thats exaggerated because both of the Queries work and i am just interessted if there is one correct way.
    Thank you in advance
    Marco

    Hi,
    As i guideline i would say, answer the question: should the result of the join be filtered or should only filtered rows be joined from a particular table?
    This is helpful in the case of outer joins also, for inner joins it doesnt matters as said already be former posters, where there may be hughe semantical differences depending of where the predicates are placed.
    From performance view, if we talk about oracle, take a look a the execution plans. You will see that there is (probably) no difference in case of inner joins. Even in case of outer joins the optimizer pushes the predicate as a filter towards the table if it semantically possible.
    Regards

  • Non-ANSI Outer Join Operator Issue (reposted due to text issues)

    I am currently using Designer 11.5.0.0. Itu2019s XI Rel 2, but Iu2019m not sure what service pack. I have created several universes with outer joins against a SQL Server 2005 database, but when I try using them in a Crystal report, I get the following error:
    Failed to retrieve date from the database. Details: 42000:[Microsoft][ODBC SQL Server Driver][SQL Server] The query uses non-ANSI outer join operators (u201C=u201D or u201C=u201D). To run this query without modification, please set the compatibility level for current database to 80 or lower, using stored procedure sp_dbcmptlevel. It is strongly recommended to rewrite the query using ANSI outer join operators (LEFT OUTER JOIN, RIGHT OUTER JOIN). In the future versions of SQL Server, non-ANSI join operators will not be supported even in backward-compatibility modes.
    Here is my ODBC DSN configuration:
    Microsoft SQL Server ODBC Driver Version 03.85.1132
    Data Source Name: FlexOPS
    Data Source Description:
    Server: dalsvrw031
    Database: (Default)
    Language: (Default)
    Translate Character
    Data: Yes
    Log Long Running Queries: No
    Log Driver Statistics: No
    Use Integrated Security: No
    Use Regional Settings: No
    Prepared Statements Option: Drop temporary procedures on disconnect
    Use Failover Server: No
    Use ANSI Quoted Identifiers: Yes
    Use ANSI Null, Paddings and Warnings: Yes
    Data Encryption: No
    Okay, so I understand what the issue is. It appears that the version of Designer that I am using does not default the ANSI92 parameter to u201CYesu201D. So all the outer joins I have created in each of my universe are using the old *= as the join operator. And apparently, the ODBC driver I am using is not very happy with that.
    As I understand it from what Iu2019ve read on other sites, I have the following options:
    1) Set the ANSI92 parameter to Yes, drop all my joins, close and re-open Designer, and recreate all of the joins.
    2) Find a different driver or connectivity method that will support non-ANSI joins.
    3) Set my database back to SQL 2000 compatibility.
    Option 1 is unappealing as it will cause a lot of time redoing all the work that Iu2019ve spent the past month doing. Option 2 is only a band-aid fix at best. Option 3 really isnu2019t an option for us.

    So I am wondering what other options I have to change these non-ANSI joins to ANSI compatible joins. Do I need to update Designer with a service pack? Is there a script out there that will automatically do this in each of the universes? I would appreciate any suggestions or guidance on this.
    Thanks,
    Lee

  • Non-ANSI Outer Join Operator Issue

    I am currently using Designer 11.5.0.0.  Itu2019s XI Rel 2, but Iu2019m not sure what service pack.  I have created several universes with outer joins against a SQL Server 2005 database, but when I try using them in a Crystal report, I get the following error:
    Failed to retrieve date from the database.
    Details:  42000:[Microsoft][ODBC SQL Server Driver][SQL Server] The query uses non-ANSI outer join operators (u201C=u201D or u201C=u201D).  To run this query without modification, please set the compatibility level for current database to 80 or lower, using stored procedure sp_dbcmptlevel.  It is strongly recommended to rewrite the query using ANSI outer join operators (LEFT OUTER JOIN, RIGHT OUTER JOIN).  In the future versions of SQL Server, non-ANSI join operators will not be supported even in backward-compatibility modes.
    Here is my ODBC DSN configuration:
    Microsoft SQL Server ODBC Driver Version 03.85.1132
    Data Source Name: FlexOPS
    Data Source Description:
    Server: dalsvrw031
    Database: (Default)
    Language: (Default)
    Translate Character Data: Yes
    Log Long Running Queries: No
    Log Driver Statistics: No
    Use Integrated Security: No
    Use Regional Settings: No
    Prepared Statements Option: Drop temporary procedures on disconnect
    Use Failover Server: No
    Use ANSI Quoted Identifiers: Yes
    Use ANSI Null, Paddings and Warnings: Yes
    Data Encryption: No
    Okay, so I understand what the issue is.  It appears that the version of Designer that I am using does not default the ANSI92 parameter to u201CYesu201D.  So all the outer joins I have created in each of my universe are using the old *= as the join operator.  And apparently, the ODBC driver I am using is not very happy with that.
    As I understand it from what Iu2019ve read on other sites, I have the following options:
    1)   Set the ANSI92 parameter to Yes, drop all my joins, close and re-open Designer, and recreate all of the joins.
    2)   Find a different driver or connectivity method that will support non-ANSI joins.
    3)   Set my database back to SQL 2000 compatibility.
    Option 1 is unappealing as it will cause a lot of time redoing all the work that Iu2019ve spent the past month doing.  Option 2 is only a band-aid fix at best.  Option 3 really isnu2019t an option for us.
    So I am wondering what other options I have to change these non-ANSI joins to ANSI compatible joins.  Do I need to update Designer with a service pack?  Is there a script out there that will automatically do this in each of the universes?
    I would appreciate any suggestions or guidance on this.
    Thanks,
    Lee
    Edited by: Lee Vance on Jul 6, 2009 10:02 PM

    Hi,
    try the following:
    open your universe in the Universe designer, go to File->Parameter, select the Parameter tab and change the value of the ANSI92 parameter from No to Yes.
    Regards,
    Stratos

  • Differences between ANSI SQL and Oracle 8/9

    Hallo,
    i'm looking for good online texts or books concerning the problem "Differences between ANSI SQL and different database implementations (ORACLE, Informix, MySQL...)" I want to check a program written in C (with ESQL) that works with an Informix-DB. In this code i want to find code that is specific to the Informix-DB. I want to change the database, so all the code should be independent from a DB. Does anybody know texts or books concerning this problem?
    thx
    Marco Seum

    Basically there is syntax difference between both of them.
    Lets say i want to join two table EMP and DEPT based on DEPTNO.
    With Oracle SQL format its like this.
    select e.*
      from emp e, dept d
    where e.deptno = d.deptnoHere the joining condition goes in the WHERE clause.
    With ANSI SQL format its like this.
    select e.*
      from emp e
      join dept d
        on e.deptno = d.deptnoHere the join condition is mentioned separately and not in WHERE clause.
    Oracle supports ANSI SQL starting from 9i version.
    You can read more about the syntax difference Here

  • What is Difference between ANSI SQL and ORACLE SQL

    Hi,
    I am going to take the assesment test for ANSI SQL Programming before that i want to know any difference between ANSI SQL and ORACLE SQL?
    I am studying for SQL but the test will be ANSI SQL please let me give an idea about the both.
    Thanks
    Merina Roslin

    Basically there is syntax difference between both of them.
    Lets say i want to join two table EMP and DEPT based on DEPTNO.
    With Oracle SQL format its like this.
    select e.*
      from emp e, dept d
    where e.deptno = d.deptnoHere the joining condition goes in the WHERE clause.
    With ANSI SQL format its like this.
    select e.*
      from emp e
      join dept d
        on e.deptno = d.deptnoHere the join condition is mentioned separately and not in WHERE clause.
    Oracle supports ANSI SQL starting from 9i version.
    You can read more about the syntax difference Here

  • Using ANSI sql in forms 9i triggers

    hi,
    could use some help here please!
    I am getting errors when trying to compile triggers in forms 9i against a 9i DB which include cursors or sql select's which are written using the ANSI join syntax.
    example:
    declare
    cursor cur_test is
    select dual1.dummy "dual1", dual2.dummy "dual2"
    from (dual dual1 inner join dual dual2 on dual1.dummy = dual2.dummy);
    begin
         null;
    end;
    when I try and compile I get error message "103" which seems to think that the SQL is not valid. If I put the same statements into recordgroups they will compile, and they run via SQL*Plus OK.
    versions are:
    Forms [32 Bit] Version 9.0.2.9.0 (Production)
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    Oracle Toolkit Version 9.0.4.0.23 (Production)
    PL/SQL Version 9.0.1.3.1 (Production)
    Oracle Procedure Builder V9.0.2.0.7 Build #1022 - Production
    database: 9.2.0.1.0
    Any ideas?!
    thanks,
    Pete

    If you remember that Sybase and MS worked together on SQLServer. Version 6.5 was pretty much the same database server. MS then built version 7.0 leaving Sybase behind. They added ANSI standard joins to their db. What did they get? PROBLEMS. Every patch contained fixes for ANSI standard joins. Even SQLServer 2000 has problems with it.
    Oracle now trys to follow MS and add ANSI joins to their database. What did it give them? BUGS. Remember this one?
    select * from sys.role$ cross join dual
    http://otn.oracle.com/deploy/security/pdf/sql_joins_alert.pdf
    Use standard joins and not ANSI joins. That will solve this problem.

  • Configure "Query Builder" for Theta-Style Joins over ANSI-Style Joins

    Can SQL Developer be configured to auto generate theta-style joins instead of ANSI-style joins when building queries? This happens when I generate a query using the Query Builder and then switch over to the Worksheet tab to see the SQL code.
    Sample code:
    Theta-style join syntax uses commas to separate multiple table names and creates the joins in the Where clause:
    SELECT c.name
    FROM instructors i, courses c
    WHERE i.firstname = 'Mary' AND i.lastname = 'Williams'
    AND i.course_id = c.course_id;
    ANSI syntax uses the JOIN and ON keywords instead:
    SELECT c.name
    FROM instructors i JOIN courses c
    ON i.course_id = c.course_id
    WHERE i.firstname = 'Mary' AND i.lastname = 'Williams';

    Hi Wes,
    There is no preference for configuring this that I know of, but Query Builder is fairly clever about detecting your flavor of SQL from the worksheet then sticking with it. If you design it graphically, the default flavor is ANSI, but QB seems to respect any worksheet edits that switch it to another flavor. I wouldn't vouch for that absolutely, but perhaps it's behavior you can take advantage of.
    Regards,
    Gary
    SQL Developer Team

  • Iso/ansi sql-99 query

    hi..
    i'm new for oracle ..
    i hav one doubt .. what is the difference between normal join and iso/ansi sql-99 joins...
    is any advantage ..
    query e.g:
    SELECT c.course_name, c.period, e.student_name
    FROM course c, enrollment e
    WHERE c.course_name = e.course_name(+)
    AND c.period = e.period(+);
    sql-99 format :
    SELECT c.course_name, c.period, e.student_name
    FROM enrollment e RIGHT OUTER JOIN course c
    ON c.course_name = e.course_name
    AND c.period = e.period;

    Hi
    -It is analogous to joining a table, and avoiding the "where" clause
    -It allows easier product migration and a reduced learning curve when cross-training
    -there is no performance increase compared to the existing syntax.
    I hope u got it
    Khurram Siddiqui
    [email protected]

  • ANSI SQL syntax?

    Hi all,
    I have a simple query
    SELECT A.*, B.Dstrct_Code FROM MSF601 A, MSF600 B
    WHERE ALTERNATE_REF LIKE 'PF%'
    AND A.alt_ref_code = B.Equip_No
    AND B.Dstrct_Code = 'ACME';
    which works fine, but I want to convert it to ANSI
    SQL syntax, so I tried
    SELECT A.*, B.Dstrct_Code FROM MSF601 A, MSF600 B
    WHERE ALTERNATE_REF LIKE 'PF%'
    INNER JOIN ON A.alt_ref_code = B.Equip_No
    AND B.Dstrct_Code = 'ACME';
    but I get
    ERROR at line 3:
    ORA-00933: SQL command not properly ended
    Could some kind soul explain why?
    Paul...

    An example that looks a lot like your example:
    SQL> select dept.*
      2       , emp.ename
      3    from dept, emp
      4   where dept.dname like '%A%'
      5   inner join on dept.deptno = emp.deptno
      6     and emp.sal > 1000
      7  /
    inner join on dept.deptno = emp.deptno
    FOUT in regel 5:
    .ORA-00933: SQL command not properly ended
    SQL> select dept.*
      2       , emp.ename
      3    from dept
      4         inner join emp on dept.deptno = emp.deptno
      5   where dept.dname like '%A%'
      6     and emp.sal > 1000
      7  /
                                    DEPTNO DNAME          LOC           ENAME
                                        30 SALES          CHICAGO       ALLEN
                                        30 SALES          CHICAGO       WARD
                                        20 RESEARCH       DALLAS        JONES
                                        30 SALES          CHICAGO       MARTIN
                                        30 SALES          CHICAGO       BLAKE
                                        10 ACCOUNTING     NEW YORK      CLARK
                                        20 RESEARCH       DALLAS        SCOTT
                                        10 ACCOUNTING     NEW YORK      KING
                                        30 SALES          CHICAGO       TURNER
                                        20 RESEARCH       DALLAS        ADAMS
                                        20 RESEARCH       DALLAS        FORD
                                        10 ACCOUNTING     NEW YORK      MILLER
    12 rijen zijn geselecteerd.Regards,
    Rob.

Maybe you are looking for