Regarding Native SQL and UNIX

Hi guys. I've developed some programs using Native SQL to connect to a SQL Server database. To do so, i configured a connection on DBCO transaction. The develop SAP server runs on Windows platform, but QA and Production runs on UNIX. So, now i need to modify my programs to run on UNIX
I know that in order to use DBCO conection to SQL Server requires the server to be on Windows, but i've been reading some postings and SAP notes, and i've read somewhere that you need at least ONE app server to be on windows...
My question is this: is there a way to specify when connecting to DBCO to use a different app server? is this automatic?
I hope i made miself clear...
Jesus

Solved it on my own

Similar Messages

  • Regarding Native SQL to access Oracle Data from SAP

    Dear Gurus,
    This query is regarding Native SQL.
    Our database is Oracle and the client's database is also Oracle.
    To access the data directly from the client's database(Oracle), can I use Native SQL commands?
    Is there any disadvantage to use Native SQL?
    If Native SQL can be used, can any one send me the code to access the data from Oracle?
    Points will be rewarded.
    Thanks & Regards,
    Neeraj K.

    The problem is always data integrity. Doing things this way you are bypassing any business logic. So for example if you are connecting to a SAP Oracle database. SAP will not support your SAP system as you are doing direct updates to the database. I would suppose that this would be the same for any other product using the Oracle database. If you are only reading data from the database then it should be fine. I would however always using API's to access/update data.
    Regards

  • Query Regarding Native SQL

    Hello Friends,
       I am having a requirement to fetch the records from 3 tables( Using inner join)
       into an internal table but I am facing a difficulty that I need to fetch the records from this table with entirely different conditions and I need to use ' UNION ALL' Command to fetch the records from the database. For Eg.
    I have to write two select statement....
    Select <f1> <f2> <f3> <f4>
    from <t1> join <t2> join <t3>
    into table ITAB
    where <Cond. 1>
    Select <f1> <f2> <f3> <f4>
    from <t1> join <t2> join <t3>
    appending table ITAB
    where <Cond. 2>
    But this is taking two much time... So the user told me to use native SQL to combine this two statement with UNION ALL.. I am using database DB2 Can anyone help me regarding this.
    Thanks,
    Navneet

    HI,
    Info in help is good to understand better. Below is the
    same for you understanding.
    ... FROM tabref1 [INNER] JOIN tabref2 ON cond
    Effect
    The data is to be selected from transparent database tables and/or views determined by tabref1 and tabref2. tabref1 and tabref2 each have the same form as in variant 1 or are themselves Join expressions. The keyword INNER does not have to be specified. The database tables or views determined by tabref1 and tabref2 must be recognized by the ABAP Dictionary.
    In a relational data structure, it is quite normal for data that belongs together to be split up across several tables to help the process of standardization (see relational databases). To regroup this information into a database query, you can link tables using the join command. This formulates conditions for the columns in the tables involved. The inner join contains all combinations of lines from the database table determined by tabref1 with lines from the table determined by tabref2, whose values together meet the logical condition (join condition) specified using ON>cond.
    Inner join between table 1 and table 2, where column D in both tables in the join condition is set the same:
    Table 1 Table 2
    A
    B
    C
    D
    D
    E
    F
    G
    H
    a1
    b1
    c1
    1
    1
    e1
    f1
    g1
    h1
    a2
    b2
    c2
    1
    3
    e2
    f2
    g2
    h2
    a3
    b3
    c3
    2
    4
    e3
    f3
    g3
    h3
    a4
    b4
    c4
    3
    |--|||--|
    Inner Join
    A
    B
    C
    D
    D
    E
    F
    G
    H
    a1
    b1
    c1
    1
    1
    e1
    f1
    g1
    h1
    a2
    b2
    c2
    1
    1
    e1
    f1
    g1
    h1
    a4
    b4
    c4
    3
    3
    e2
    f2
    g2
    h2
    |--||||||||--|
    Example
    Output a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
    DATA: DATE LIKE SFLIGHT-FLDATE,
    CARRID LIKE SFLIGHT-CARRID,
    CONNID LIKE SFLIGHT-CONNID.
    SELECT FCARRID FCONNID F~FLDATE
    INTO (CARRID, CONNID, DATE)
    FROM SFLIGHT AS F INNER JOIN SPFLI AS P
    ON FCARRID = PCARRID AND
    FCONNID = PCONNID
    WHERE P~CITYFROM = 'FRANKFURT'
    AND P~CITYTO = 'NEW YORK'
    AND F~FLDATE BETWEEN '20010910' AND '20010920'
    AND FSEATSOCC < FSEATSMAX.
    WRITE: / DATE, CARRID, CONNID.
    ENDSELECT.
    If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or a table alias.
    Note
    In order to determine the result of a SELECT command where the FROM clause contains a join, the database system first creates a temporary table containing the lines that meet the ON condition. The WHERE condition is then applied to the temporary table. It does not matter in an inner join whether the condition is in the ON or WHEREclause. The following example returns the same solution as the previous one.
    Example
    Output of a list of all flights from Frankfurt to New York between September 10th and 20th, 2001 that are not sold out:
    DATA: DATE LIKE SFLIGHT-FLDATE,
    CARRID LIKE SFLIGHT-CARRID,
    CONNID LIKE SFLIGHT-CONNID.
    SELECT FCARRID FCONNID F~FLDATE
    INTO (CARRID, CONNID, DATE)
    FROM SFLIGHT AS F INNER JOIN SPFLI AS P
    ON FCARRID = PCARRID
    WHERE FCONNID = PCONNID
    AND P~CITYFROM = 'FRANKFURT'
    AND P~CITYTO = 'NEW YORK'
    AND F~FLDATE BETWEEN '20010910' AND '20010920'
    AND FSEATSOCC < FSEATSMAX.
    WRITE: / DATE, CARRID, CONNID.
    ENDSELECT.
    Note
    Since not all of the database systems supported by SAP use the standard syntax for ON conditions, the syntax has been restricted. It only allows those joins that produce the same results on all of the supported database systems:
    Only a table or view may appear to the right of the JOIN operator, not another join expression.
    Only AND is possible in the ON condition as a logical operator.
    Each comparison in the ON condition must contain a field from the right-hand table.
    If an outer join occurs in the FROM clause, all the ON conditions must contain at least one "real" JOIN condition (a condition that contains a field from tabref1 amd a field from tabref2.
    Note
    In some cases, '*' may be specified in the SELECT clause, and an internal table or work area is entered into the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the FROM clause, according to the structure of each table work area. There can then be gaps between table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, not simply by counting the total number of fields. For an example, see below:
    Variant 3
    ... FROM tabref1 LEFT [OUTER] JOIN tabref2 ON cond
    Effect
    Selects the data from the transparent database tables and/or views specified in tabref1 and tabref2. tabref1 und tabref2 both have either the same form as in variant 1 or are themselves join expressions. The keyword OUTER can be omitted. The database tables or views specified in tabref1 and tabref2 must be recognized by the ABAP-Dictionary.
    In order to determine the result of a SELECT command where the FROM clause contains a left outer join, the database system creates a temporary table containing the lines that meet the ON condition. The remaining fields from the left-hand table (tabref1) are then added to this table, and their corresponding fields from the right-hand table are filled with ZERO values. The system then applies the WHERE condition to the table.
    Left outer join between table 1 and table 2 where column D in both tables set the join condition:
    Table 1 Table 2
    A
    B
    C
    D
    D
    E
    F
    G
    H
    a1
    b1
    c1
    1
    1
    e1
    f1
    g1
    h1
    a2
    b2
    c2
    1
    3
    e2
    f2
    g2
    h2
    a3
    b3
    c3
    2
    4
    e3
    f3
    g3
    h3
    a4
    b4
    c4
    3
    |--|||--|
    Left Outer Join
    A
    B
    C
    D
    D
    E
    F
    G
    H
    a1
    b1
    c1
    1
    1
    e1
    f1
    g1
    h1
    a2
    b2
    c2
    1
    1
    e1
    f1
    g1
    h1
    a3
    b3
    c3
    2
    NULL
    NULL
    NULL
    NULL
    NULL
    a4
    b4
    c4
    3
    3
    e2
    f2
    g2
    h2
    |--||||||||--|
    Example
    Output a list of all custimers with their bookings for October 15th, 2001:
    DATA: CUSTOMER TYPE SCUSTOM,
    BOOKING TYPE SBOOK.
    SELECT SCUSTOMNAME SCUSTOMPOSTCODE SCUSTOM~CITY
    SBOOKFLDATE SBOOKCARRID SBOOKCONNID SBOOKBOOKID
    INTO (CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,
    BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,
    BOOKING-BOOKID)
    FROM SCUSTOM LEFT OUTER JOIN SBOOK
    ON SCUSTOMID = SBOOKCUSTOMID AND
    SBOOK~FLDATE = '20011015'
    ORDER BY SCUSTOMNAME SBOOKFLDATE.
    WRITE: / CUSTOMER-NAME, CUSTOMER-POSTCODE, CUSTOMER-CITY,
    BOOKING-FLDATE, BOOKING-CARRID, BOOKING-CONNID,
    BOOKING-BOOKID.
    ENDSELECT.
    If there are columns with the same name in both tables, you must distinguish between them by prefixing the field descriptor with the table name or using an alias.
    Note
    For the resulting set of a SELECT command with a left outer join in the FROM clause, it is generally of crucial importance whether a logical condition is in the ON or WHERE condition. Since not all of the database systems supported by SAP themselves support the standard syntax and semantics of the left outer join, the syntax has been restricted to those cases that return the same solution in all database systems:
    Only a table or view may come after the JOIN operator, not another join statement.
    The only logical operator allowed in the ON condition is AND.
    Each comparison in the ON condition must contain a field from the right-hand table.
    Comparisons in the WHERE condition must not contain a field from the right-hand table.
    The ON condition must contain at least one "real" JOIN condition (a condition in which a field from tabref1 as well as from tabref2 occurs).
    Note
    In some cases, '*' may be specivied as the field list in the SELECT clause, and an internal table or work area is entered in the INTO clause (instead of a list of fields). If so, the fields are written to the target area from left to right in the order in which the tables appear in the llen in der FROM clause, according to the structure of each table work area. There can be gaps between the table work areas if you use an Alignment Request. For this reason, you should define the target work area with reference to the types of the database tables, as in the following example (not simply by counting the total number of fields).
    Example
    Example of a JOIN with more than two tables: Select all flights from Frankfurt to New York between September 10th and 20th, 2001 where there are available places, and display the name of the airline.
    DATA: BEGIN OF WA,
    FLIGHT TYPE SFLIGHT,
    PFLI TYPE SPFLI,
    CARR TYPE SCARR,
    END OF WA.
    SELECT * INTO WA
    FROM ( SFLIGHT AS F INNER JOIN SPFLI AS P
    ON FCARRID = PCARRID AND
    FCONNID = PCONNID )
    INNER JOIN SCARR AS C
    ON FCARRID = CCARRID
    WHERE P~CITYFROM = 'FRANKFURT'
    AND P~CITYTO = 'NEW YORK'
    AND F~FLDATE BETWEEN '20010910' AND '20010920'
    AND FSEATSOCC < FSEATSMAX.
    WRITE: / WA-CARR-CARRNAME, WA-FLIGHT-FLDATE, WA-FLIGHT-CARRID,
    WA-FLIGHT-CONNID.
    ENDSELECT.
    Kishore.

  • Regarding Native sql

    Hi guys,
    we are planning to go Oracle up next week. so could you please confirm below two points.
    1- we need to know what problem will occur if we used Native sql inside the Abap programs(due to Oracle up).
    2- Is it true that Native SQl communication passess thru Oracle client. Please confirm
    Thanks.
    Baasha

    Hi, please refer to the following pages.
    Native SQL
    Native SQL for Oracle
    especially in the first one, you will find your answers.
    Now, concerning point 2, have you considered posting the question in the SAP on Oracle forum in SDN ?
    Regards,
    Stéphan

  • Native SQL and CMP

    Hi
    In our application we are using Swing-clients that access our Informix database through CMP beans in SUN One 2004 Q2 appserver.
    We thought we could rely on the database constraints when creating and updating ie. if a column in a table violated the constraint the native Informix errorcode and info could be retrieved/exposed to our applicationcode.
    Now it doesn't seem like this, all we get is a corba marshalling exception.
    Is there really noway to inform our sessionbeans of what native SQL error occured ? Informix have a error-structure and from that naive structure you can extract information about what constraint was violated - a useful information when trying to find the errors.

    Hi,
    finally I could solve this problem by myself.
    First of all i used the wrong lookup name (deployedAdapters/testPMF).
    Right one's are
    -  java:comp/env/testPMF
    -  deployedAdapters/testPMF/shareable/testPMF
    Additionally I didn't get it working with an DataSource created by the Visual Administrator. So I deployed a DataSource with my EAR project using data-sources.xml
    I hope this is helpfull for other developers having this problem
    peter

  • Regarding PL/SQL and NULL

    I have a question regarding a trigger written in a forms application. This is of course a PL/SQL routine.
    This is my code:
    IF :variable = '237' THEN
    GOTO t_237;
    ELSEIF :varible = '238' THEN
    GOTO t_238;
    ELSE
    MESSAGE('Wrong');
    END IF;
    << t_237 >>
    NULL;
    << t_238 >>
    more code
    If :variable is 237 then I will goto label t_237 which has one single statement NULL. What happens when NULL is executed. Is this trigger aborted? Just like a return statement in other program languages such as Java.
    I want to move the NULL statement because I don't like the GOTO stament

    I have worked with PL/SQL for ten years and have NEVER used a GOTO. Using GOTO was declared a bad programming practice 30 years ago.
    Jose's suggestion is the correct method to use.
    That null; statement is just a placeholder -- it does nothing. However, after the null;, the process falls into the t_238 process and runs those commands.
    If you want a procedure to stop at some point, you should use a Raise Form_trigger_failure; or a Return;

  • SQL and Unix

    Hi,
    I am not being able to store a count (*) result set into a variable in my shell script. For example, I would like this to happen:
    sqlplus -s username/passwd@DB << END
    some_variable = select count(*) from some_table where some_value = value;
    END
    Could you please help?
    Thanks,
    rrvvg.

    I ran across this thread in the forums that talks about this very thing:
    Can i pass output from PL/SQL Block (Urgent)
    Also, I found this one:
    http://www.dbforums.com/showthread.php?t=1290471
    Greg Pike
    http://www.singlequery.com

  • Query SAP Database with Native Sql.

    Hi,
    I would like to query the table MARA with native sql and return all headings and data
    Select * from MARA where MATNR = '00000000151515'          
    <i>I need this to be able to TEST my Sql statements.</i>
    In SqlServer you have the Query Analyser where I can do just this, but is there some nice in SAP Tool for this as well ?
    [Unfortanely I can't connect to SAP_U01 database from QA...]
    //Martin

    Hi Martin,
    maybe you give ST05 a try: last button gives the possibility to enter a SQL-statement directly - and for explanation it has to be executed (somehow).
    Regards,
    Christian

  • Use of Native SQL

    Can i use all sql statementsa which are used in oracle ? Basically I am more interested in oracle data conversion functions like to_date(),To_Char() with appropriate formats.
    I know that to use oracle's native commands i have to use Native SQL and for that i have to write my query between EXEC SQL and ENDEXEC.  But i am not able to use query that uses date conversion fuctions like to_date() and to_char().
    Also i want to know the list of SQL statements which can be used with Native SQL in Oracle.

    HI.
    please refer this one.
    To avoid the standard F4 help to be show, insert the event PROCESS ON-VALUE-REQUEST request in the program and add a field statement for the field that should trigger the F4 help. In the module called from PROCESS ON-VALUE-REQUEST request, call function module F4IF_FIELD_VALUE_REQUEST.
    Example Code :
    process before output.
    process after input.
    PROCESS ON VALUE-REQUEST.
    FIELD sflight-carrid MODULE f4_help_for_carrid.
    MODULE f4_help_for_carrid INPUT.
    NOTE:
    Tabname/fieldname is the name of the table and field
    for which F4 should be shown.
    Dynprog/Dynpnr/Dynprofield are the names of the Progran/Dynpro/Field
    in which the f4 value should be returned.
    Value: The value of the Dynpro field when calling the F4 help.
    You can limit the values shown, by inseting a value in this parameter
    e.g 'A*' to show only values beginning with A
    CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
    tabname = 'SFLIGHT'
    fieldname = 'CARRID'
    SEARCHHELP = ' '
    SHLPPARAM = ' '
    dynpprog = 'ZDANY_F4_OWN_CALL'
    dynpnr = '0100'
    dynprofield = 'SFLIGHT-CARRID'
    STEPL = 0
    value = 'A*'
    MULTIPLE_CHOICE = ' '
    DISPLAY = ' '
    SUPPRESS_RECORDLIST = ' '
    CALLBACK_PROGRAM = ' '
    CALLBACK_FORM = ' '
    TABLES
    RETURN_TAB =
    EXCEPTIONS
    FIELD_NOT_FOUND = 1
    NO_HELP_FOR_FIELD = 2
    INCONSISTENT_HELP = 3
    NO_VALUES_FOUND = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDMODULE. " F4_help_for_carrid
    To control F4 help in a selection screen use the AT SELECTION-SCREEN ON VALUE-REQUEST FOR event.Note that for ranges both the low and high value of the field must have there own ON VALUE-REQUEST
    Example:
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prctr-low.
    PERFORM f4_help_carrid.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_prctr-high.
    PERFORM f4_help_carrid
    Rewards all helpfull answers.
    Regards.
    Jay

  • Named parameters in Native SQL

    A little background first:
    Our website uses Hibernate as it's JPA provider, but we've run into several issues with it, one of which they actively refuse to fix out of pure arrogance, even when we gave them a good patch for it. The other one is a performance issue that can be greatly improved by passing arrays as parameters, which I've read rumours is supported in EclipseLink. I first tried implementing a Hibernate UserType as they've specified and it turns out they never read them into the Map that looks-up parameter types during binding, even though it's loaded from their hibernate.cfg.xml. In other words, they're only pretending to support custom user types, but unless you're writing-out the full manual loading of their configuration, there's no way to do it.
    After a day of trying to fix all the relation annotations that EclipseLink finds unacceptable in our project (which only uses native SQL and EntityManager.find for selects) I finally got it running and came to discover you don't support named parameters in native SQL. That was really disappointing, because a few months ago we migrated all our queries to named parameters, because positioning ones were too difficult to track and caused more bugs when we had to add more criterias.
    My questions are these:
    Are named parameters for native SQL not supported by JPA specifications or because they are considered low priority?
    Would you accept a patch that supports them?
    Can we really use arrays and/or lists as parameters in queries like this "SELECT * FROM some_table WHERE my_column_a IN ? AND my_column_b NOT IN ?"
    If yes to above, would it still work if the first one is an array of integers and the second is an array of strings?
    Would it work if it's in native SQL and the column types cannot be resolved due to query complexity?

    A little background first:
    Our website uses Hibernate as it's JPA provider, but we've run into several issues with it, one of which they actively refuse to fix out of pure arrogance, even when we gave them a good patch for it. The other one is a performance issue that can be greatly improved by passing arrays as parameters, which I've read rumours is supported in EclipseLink. I first tried implementing a Hibernate UserType as they've specified and it turns out they never read them into the Map that looks-up parameter types during binding, even though it's loaded from their hibernate.cfg.xml. In other words, they're only pretending to support custom user types, but unless you're writing-out the full manual loading of their configuration, there's no way to do it.
    After a day of trying to fix all the relation annotations that EclipseLink finds unacceptable in our project (which only uses native SQL and EntityManager.find for selects) I finally got it running and came to discover you don't support named parameters in native SQL. That was really disappointing, because a few months ago we migrated all our queries to named parameters, because positioning ones were too difficult to track and caused more bugs when we had to add more criterias.
    My questions are these:
    Are named parameters for native SQL not supported by JPA specifications or because they are considered low priority?
    Would you accept a patch that supports them?
    Can we really use arrays and/or lists as parameters in queries like this "SELECT * FROM some_table WHERE my_column_a IN ? AND my_column_b NOT IN ?"
    If yes to above, would it still work if the first one is an array of integers and the second is an array of strings?
    Would it work if it's in native SQL and the column types cannot be resolved due to query complexity?

  • How to get oracle 9i blob column into an itab  in sap using Native SQL

    Hi ,
    We are using SAP ECC 5.0  and we need to coonect to an oracle database ver 9i rel2.
    We need to get the data stored in a blob(pdf/jpeg) into an itab and later
    use it for futher processing.
    I am familiar with using native SQL and I wrote a stored procedure in the non sap oracle database to send the blob info into an internal table in sap.
    But the information is in hex format and the long raw of SAP does not handle this very well.
    Plz see my code below.
    data: itab_insp_drawing like zpicture_cluster(which is of type lraw - 7902 )
          occurs 100 with header line.
    EXEC SQL.
        EXECUTE PROCEDURE
           proc_get_insp_drawings  (
                   IN  :itab-aq_id,
                   IN  :itab-section_id,
                   IN  :t_in_position,
                   out :itab_insp_drawing-picture,
                   OUT :t_blob_length,
                   out :t_out_position,
                   OUT :t_status  )
       ENDEXEC.
      append itab_insp_drawing.
      while t_out_position < t_blob_length.
       EXEC SQL.
        EXECUTE PROCEDURE
           proc_get_insp_drawings  (
                   IN  :itab-aq_id,
                   IN  :itab-section_id,
                   IN  :t_in_position,
                   out :itab_insp_drawing-picture,
                   OUT :t_blob_length,
                   out :t_out_position,
                   OUT :t_status  )
       ENDEXEC.
       append itab_insp_drawing.
       endwhile.
    Any ideas of how to handle blobs from non sap oracle table. I need this blob into an itab in sap.
    Help appreciated.
    Thanks
    Mala

    Please refer the example in this link which deals with Oracle date format.
    You can finnd a command DECODE which is used for date formats. If you have a look at whole theory then you will get an idea.
    Link:[Bulk insert SQL command to transfer data from SAP to Oracle|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/bulk-insert-sql-command-to-transfer-data-from-sap-to-oracle-cl_sql_connection-3780804]

  • How can I extract the native SQL generated by TopLink?

    How can I extract the native SQL generated by TopLink?
    This is useful for example to use pagination, or pass the SQL to a stored procedure that may do many things, like using a cursor, or apply security.
    Pagination example where the SQL inside the inner parentheses are generated from Toplink, and the outer SQL is generic:
    select *
    from
    (select xx.*, rownum as rn
    from
    (select o.order_id, r.name, ...
    from placed_order o, restaurant r
    where o.restaurant_id = r.restaurant_id
    order by o.order_ext_id
    ) xx
    where rownum < 21)
    where rn > 10

    Alternatively, you can open your sessions.xml in the Mapping Workbench and for a specific session, you can Click the Login Tab and then the Options tab. Then select "Native SQL" and it will be outputted to the console (assuming that is where you outputing it).
    zb

  • Native SQL Regarding

    Hai Experts,
    I need To  Insert Values Into Sql Server Table Using EXEC And ENDEXEC Commands.
    Can Any one Give Some Suggestion.
    <REMOVED BY MODERATOR>
    Thanks In Adv,
    Jai.M
    Edited by: Alvaro Tejada Galindo on Feb 22, 2008 4:38 PM

    Hi,
    EXEC SQl statement does Native SQL .Normally we use OPEN sql statement.
    This is not database specific.So datbase convetor converts into database specific sql statements for our sql statements.This is slow fetching compared to Native sql.
    Open SQL allows you to access database tables declared in the ABAP Dictionary regardless of the database platform that you R/3 System is using. Native SQL allows you to use database-specific SQL statements in an ABAP program. This means that you can use database tables that are not administered by the ABAP Dictionary, and therefore integrate data that is not part of the R/3 System.
    As a rule, an ABAP program containing database-specific SQL statements will not run under different database systems. If your program will be used on more than one database platform, only use Open SQL statements.
    Native SQL Statements in ABAP Programs
    To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:
    REPORT demo_native_sql.
    DATA: BEGIN OF wa,
    connid TYPE spfli-connid,
    cityfrom TYPE spfli-cityfrom,
    cityto TYPE spfli-cityto,
    END OF wa.
    DATA c1 TYPE spfli-carrid VALUE 'LH'.
    EXEC SQL PERFORMING loop_output.
    SELECT connid, cityfrom, cityto
    INTO :wa
    FROM spfli
    WHERE carrid = :c1
    ENDEXEC.
    FORM loop_output.
    WRITE: / wa-connid, wa-cityfrom, wa-cityto.
    ENDFORM.
    <REMOVED BY MODERATOR>
    Cheers,
    Chandra Sekhar.
    Edited by: Alvaro Tejada Galindo on Feb 22, 2008 4:40 PM

  • UpdateAllQuery and Native SQL

    Hi,
    I have below three update statements, and need to be in one transaction. How can I accomplish it using UpdateAllQuery? Finance_Management is a child table of Org mapped through org_id; Org_Finance is a child table of Finance_Management linked by finance_management_id.
    Update Org
    Set Account_Balance = Account_Balance + 25, Update_User = 'Jeff_Org', Update_Date = Systimestamp
    Where Org_Id = 10226;
    Update Finance_Management
    Set Account_Balance = (Select Account_Balance From Org Where Org_Id = 10226),
    Transaction_Amount = 25, Transaction_Date = Systimestamp
    where finance_management_id = 1701152;
    Update Org_Finance
    Set Check_Mo_Number = 5432, Payment_Type = 'C'
    where Finance_Management_Id = 1701152;
    Alternatively, when I tried native SQL with executeNonSelectingCall within unit of work like below, it appears that even through the second SQLCall failed, the first one still committed to the database. How can I ensure the three SQLCalls are in one transaction?
    UnitOfWork uow = getSessionFactory().acquireUnitOfWork();
    uow.executeNonSelectingCall(new SQLCall(orgSql));
    uow.executeNonSelectingCall(new SQLCall(fmSql));
    uow.executeNonSelectingCall(new SQLCall(orgFnSql));
    uow.commit();
    Thanks for your help!
    Jeffrey

    I think I have figured it out.
    For using UpdateAllQuery, three different UpdateAllQueries need to be constructed. One critical piece is that, use beginEarlyTransaction() before execute the three queries inside UOW. Same is true when using native SQLs.
    Few questions though that I need some experts to clear my mind:
    - so all database Queries can run inside unit of work, become part of the single transaction within UOW by using beginEarlyTransaction(), is this correct?
    - How about insert? InsertObjectQuery and WriteObjectQuery don't seem allow to use expression, which I need for populating a field like "Account_Balance = (Select Account_Balance From Org Where Org_Id = 10226)". Any suggestions on what API call I should use without using native SQL?
    Thanks,
    Jeffrey

  • Native SQL Performance Difference Between Hard-Coded Value and Parameter

    Hi,
    I have a native SQL (Oracle) query (fairly long & complex with a few sub-queries) that returns in under a second in both ODSI and using an external SQL tool. This query has a hard-coded value for a particular column, namely, a date column.
    When I modify the ODSI function signature so that I pass in a parameter and then replace the hard-coded value in the native SQL with the appropriate parameter binding notation (i.e. '?'), the query takes much longer (2-30 seconds). The duration of the query depends on how many records are actually returned, so it must be running a separate query for each of the results (i.e. the more results returned, the longer the query takes to return).
    What can I do to keep the duration of my ODSI query low while allowing for the parameter?

    OSDI plan with date parameter:
    <?xml version="1.0"?>
    <source ns="fn-bea" name="jdbc.wcb.fineos" kind="relational" tip="jdbc.wcb.fineos">
    <![CDATA[select codeid, description, FEE_CODE_DOC_TYPE, ismax, isovr
    from
    select distinct
    sd.codeid, sd.description,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-MAX (MAXIMUM AMOUNT)'
    ) ISMAX,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-OVR (Overrideable)'
    ISOVR,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-INT (Internet Enterable)'
    ISINT
    ,trow.answerstr FEE_CODE_DOC_TYPE
    from wcbapp.tocorganisation o, wcbapp.tolpartydetails pd, wcbapp.tolserviceagrmtforprovider safp,
    wcbapp.tolserviceagreement sa, wcbapp.tolserviceagreementversion sav, wcbapp.rsrvchrgrsrvagrvrserviceagreem scg_sav,
    wcbapp.tolservicechargegroup scg, wcbapp.tolservicechargegroupversion scgv, wcbapp.tolserviceprovisionagreement spa,
    wcbapp.tolservicedefinition sd
    ,wcbapp.trow trow, wcbapp.tlookupversion tlookupversion, wcbapp.tlookup tlookup
    where
    trow.i_lkpver_rows = tlookupversion.i
    and trow.c_lkpver_rows = tlookupversion.c
    and tlookupversion.i_lookup_versions = tlookup.i
    and tlookupversion.c_lookup_versions = tlookup.c
    and sd.codeid = trow.minstr_1
    and sd.codeid = trow.maxstr_1
    and tlookup.name = 'FeeCodeToDocumentLookup' and
    spa.i_service_serviceratede = sd.i and
    spa.c_service_serviceratede = sd.c and
    spa.i_srchrgrv_serviceratede = scgv.i and
    spa.c_srchrgrv_serviceratede = scgv.c and
    scgv.i_srvchrgr_servicecharge = scg.i and
    scgv.c_srvchrgr_servicecharge = scg.c and
    scg.i = scg_sav.i_from and
    scg.c = scg_sav.c_from and
    scg_sav.i_to = sav.i and
    scg_sav.c_to = sav.c and
    sav.i_srvcagrm_serviceagreem = sa.i and
    sav.c_srvcagrm_serviceagreem = sa.c and
    sa.i = safp.i_srvcagrm_provider and
    sa.c = safp.c_srvcagrm_provider and
    safp.i_prtdtls_serviceagreem = pd.i and
    safp.c_prtdtls_serviceagreem = pd.c and
    pd.i_ocprty_party = o.i and
    pd.c_ocprty_party = o.c and
    ? between safp.effectivedate and safp.enddate and
    o.customerno = ? || ?
    order by sd.codeid
    where ISINT = 1]]>
    <variable name="__fparam0" kind="EXTERNAL">
    </variable>
    <variable name="__fparam1" kind="EXTERNAL">
    </variable>
    <variable name="__fparam2" kind="EXTERNAL">
    </variable>
    </source>
    OSDI plan with date constant:
    <?xml version="1.0"?>
    <source ns="fn-bea" name="jdbc.wcb.fineos" kind="relational" tip="jdbc.wcb.fineos">
    <![CDATA[select codeid, description, FEE_CODE_DOC_TYPE, ismax, isovr
    from
    select distinct
    sd.codeid, sd.description,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-MAX (MAXIMUM AMOUNT)'
    ) ISMAX,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-OVR (Overrideable)'
    ISOVR,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-INT (Internet Enterable)'
    ISINT
    ,trow.answerstr FEE_CODE_DOC_TYPE
    from wcbapp.tocorganisation o, wcbapp.tolpartydetails pd, wcbapp.tolserviceagrmtforprovider safp,
    wcbapp.tolserviceagreement sa, wcbapp.tolserviceagreementversion sav, wcbapp.rsrvchrgrsrvagrvrserviceagreem scg_sav,
    wcbapp.tolservicechargegroup scg, wcbapp.tolservicechargegroupversion scgv, wcbapp.tolserviceprovisionagreement spa,
    wcbapp.tolservicedefinition sd
    ,wcbapp.trow trow, wcbapp.tlookupversion tlookupversion, wcbapp.tlookup tlookup
    where
    trow.i_lkpver_rows = tlookupversion.i
    and trow.c_lkpver_rows = tlookupversion.c
    and tlookupversion.i_lookup_versions = tlookup.i
    and tlookupversion.c_lookup_versions = tlookup.c
    and sd.codeid = trow.minstr_1
    and sd.codeid = trow.maxstr_1
    and tlookup.name = 'FeeCodeToDocumentLookup' and
    spa.i_service_serviceratede = sd.i and
    spa.c_service_serviceratede = sd.c and
    spa.i_srchrgrv_serviceratede = scgv.i and
    spa.c_srchrgrv_serviceratede = scgv.c and
    scgv.i_srvchrgr_servicecharge = scg.i and
    scgv.c_srvchrgr_servicecharge = scg.c and
    scg.i = scg_sav.i_from and
    scg.c = scg_sav.c_from and
    scg_sav.i_to = sav.i and
    scg_sav.c_to = sav.c and
    sav.i_srvcagrm_serviceagreem = sa.i and
    sav.c_srvcagrm_serviceagreem = sa.c and
    sa.i = safp.i_srvcagrm_provider and
    sa.c = safp.c_srvcagrm_provider and
    safp.i_prtdtls_serviceagreem = pd.i and
    safp.c_prtdtls_serviceagreem = pd.c and
    pd.i_ocprty_party = o.i and
    pd.c_ocprty_party = o.c and
    '01-MAY-11' between safp.effectivedate and safp.enddate and
    o.customerno = ? || ?
    order by sd.codeid
    where ISINT = 1]]>
    <variable name="__fparam0" kind="EXTERNAL">
    </variable>
    <variable name="__fparam1" kind="EXTERNAL">
    </variable>
    </source>
    ODSI Audit with date parameter:
    [Thu May 12 13:02:23 GMT-06:00 2011] Starting...
    Query compilation time: 0 ms
    Query evaluation time: 16142 ms
    Operation duration: 16189 ms
    Audit Event:
    common/application
    user: weblogic
    name: ClaimsDataspace
    server: AdminServer
    eventkind: evaluation
    query/cache/queryplan
    found: false
    type: XQUERY_PLAN_CACHE
    query/cache/queryplan
    type: XQUERY_PLAN_CACHE
    inserted: true
    query/performance
    compiletime: 0
    common/session/query/invocation
    time: Thu May 12 13:02:07 GMT-06:00 2011
    blocksize: 65536
    duration: 16001
    common/session/query/invocation
    time: Thu May 12 13:02:23 GMT-06:00 2011
    blocksize: 65536
    duration: 47
    common/session/query/invocation
    time: Thu May 12 13:02:23 GMT-06:00 2011
    blocksize: 65536
    duration: 46
    common/session/query/invocation
    time: Thu May 12 13:02:23 GMT-06:00 2011
    blocksize: 35779
    duration: 16
    query/wrappers/relational
    source: jdbc.wcb.fineos
    sql:
    select codeid, description, FEE_CODE_DOC_TYPE, ismax, isovr
    from
    select distinct
    sd.codeid, sd.description,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-MAX (MAXIMUM AMOUNT)'
    ) ISMAX,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-OVR (Overrideable)'
    ISOVR,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-INT (Internet Enterable)'
    ISINT
    ,trow.answerstr FEE_CODE_DOC_TYPE
    from wcbapp.tocorganisation o, wcbapp.tolpartydetails pd, wcbapp.tolserviceagrmtforprovider safp,
    wcbapp.tolserviceagreement sa, wcbapp.tolserviceagreementversion sav, wcbapp.rsrvchrgrsrvagrvrserviceagreem scg_sav,
    wcbapp.tolservicechargegroup scg, wcbapp.tolservicechargegroupversion scgv, wcbapp.tolserviceprovisionagreement spa,
    wcbapp.tolservicedefinition sd
    ,wcbapp.trow trow, wcbapp.tlookupversion tlookupversion, wcbapp.tlookup tlookup
    where
    trow.i_lkpver_rows = tlookupversion.i
    and trow.c_lkpver_rows = tlookupversion.c
    and tlookupversion.i_lookup_versions = tlookup.i
    and tlookupversion.c_lookup_versions = tlookup.c
    and sd.codeid = trow.minstr_1
    and sd.codeid = trow.maxstr_1
    and tlookup.name = 'FeeCodeToDocumentLookup' and
    spa.i_service_serviceratede = sd.i and
    spa.c_service_serviceratede = sd.c and
    spa.i_srchrgrv_serviceratede = scgv.i and
    spa.c_srchrgrv_serviceratede = scgv.c and
    scgv.i_srvchrgr_servicecharge = scg.i and
    scgv.c_srvchrgr_servicecharge = scg.c and
    scg.i = scg_sav.i_from and
    scg.c = scg_sav.c_from and
    scg_sav.i_to = sav.i and
    scg_sav.c_to = sav.c and
    sav.i_srvcagrm_serviceagreem = sa.i and
    sav.c_srvcagrm_serviceagreem = sa.c and
    sa.i = safp.i_srvcagrm_provider and
    sa.c = safp.c_srvcagrm_provider and
    safp.i_prtdtls_serviceagreem = pd.i and
    safp.c_prtdtls_serviceagreem = pd.c and
    pd.i_ocprty_party = o.i and
    pd.c_ocprty_party = o.c and
    ? between safp.effectivedate and safp.enddate and
    o.customerno = ? || ?
    order by sd.codeid
    where ISINT = 1
    parameters:
    2011-05-01T00:00:00
    DOC
    007492
    time: 16048
    rows: 1967
    query/performance
    evaltime: 16142
    query/service
    result:
    *** removed due to length ***
    query/service
    function: getFeeCodeByCaregiverEffectiveDate1
    arity: 3
    dataservice: ld:org/wcb/claims/payment/FINEOS/physical/SQL.ds
    query:
    import schema namespace t1 = "http://www.test.com/claims/payment" at "ld:org/wcb/claims/payment/FINEOS/physical/schemas/SQL.xsd";
    declare namespace ns0="ld:org/wcb/claims/payment/FINEOS/physical/SQL";
    declare namespace ns1="http://www.w3.org/2001/XMLSchema";
    declare variable $__fparam0 as ns1:dateTime external;
    declare variable $__fparam1 as ns1:string external;
    declare variable $__fparam2 as ns1:string external;
    fn:subsequence(
    for $FeeCode3 in ns0:getFeeCodeByCaregiverEffectiveDate1($__fparam0,$__fparam1,$__fparam2)
         return
                   $FeeCode3
    ,1,5000)
    parameters:
    2011-05-01T00:00:00
    DOC
    007492
    common/time
    duration: 16189
    timestamp: Thu May 12 13:02:07 GMT-06:00 2011
    [Thu May 12 13:02:23 GMT-06:00 2011] End
    ODSI Audit with date constant:
    [Thu May 12 13:10:00 GMT-06:00 2011] Starting...
    Query compilation time: 0 ms
    Query evaluation time: 359 ms
    Operation duration: 375 ms
    Audit Event:
    common/application
    user: weblogic
    name: ClaimsDataspace
    server: AdminServer
    eventkind: evaluation
    query/cache/queryplan
    found: true
    type: XQUERY_PLAN_CACHE
    query/performance
    compiletime: 0
    common/session/query/invocation
    time: Thu May 12 13:10:00 GMT-06:00 2011
    blocksize: 59256
    duration: 359
    query/wrappers/relational
    source: jdbc.wcb.fineos
    sql:
    select codeid, description, FEE_CODE_DOC_TYPE, ismax, isovr
    from
    select distinct
    sd.codeid, sd.description,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-MAX (MAXIMUM AMOUNT)'
    ) ISMAX,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-OVR (Overrideable)'
    ISOVR,
    select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
    sss.i_from = sd.i and
    sss.c_from = sd.c and
    sss.i_to = ss.i and
    sss.c_to = ss.c and
    sd1.codeid = sd.codeid and
    ss.name = 'FEEGROUP-INT (Internet Enterable)'
    ISINT
    ,trow.answerstr FEE_CODE_DOC_TYPE
    from wcbapp.tocorganisation o, wcbapp.tolpartydetails pd, wcbapp.tolserviceagrmtforprovider safp,
    wcbapp.tolserviceagreement sa, wcbapp.tolserviceagreementversion sav, wcbapp.rsrvchrgrsrvagrvrserviceagreem scg_sav,
    wcbapp.tolservicechargegroup scg, wcbapp.tolservicechargegroupversion scgv, wcbapp.tolserviceprovisionagreement spa,
    wcbapp.tolservicedefinition sd
    ,wcbapp.trow trow, wcbapp.tlookupversion tlookupversion, wcbapp.tlookup tlookup
    where
    trow.i_lkpver_rows = tlookupversion.i
    and trow.c_lkpver_rows = tlookupversion.c
    and tlookupversion.i_lookup_versions = tlookup.i
    and tlookupversion.c_lookup_versions = tlookup.c
    and sd.codeid = trow.minstr_1
    and sd.codeid = trow.maxstr_1
    and tlookup.name = 'FeeCodeToDocumentLookup' and
    spa.i_service_serviceratede = sd.i and
    spa.c_service_serviceratede = sd.c and
    spa.i_srchrgrv_serviceratede = scgv.i and
    spa.c_srchrgrv_serviceratede = scgv.c and
    scgv.i_srvchrgr_servicecharge = scg.i and
    scgv.c_srvchrgr_servicecharge = scg.c and
    scg.i = scg_sav.i_from and
    scg.c = scg_sav.c_from and
    scg_sav.i_to = sav.i and
    scg_sav.c_to = sav.c and
    sav.i_srvcagrm_serviceagreem = sa.i and
    sav.c_srvcagrm_serviceagreem = sa.c and
    sa.i = safp.i_srvcagrm_provider and
    sa.c = safp.c_srvcagrm_provider and
    safp.i_prtdtls_serviceagreem = pd.i and
    safp.c_prtdtls_serviceagreem = pd.c and
    pd.i_ocprty_party = o.i and
    pd.c_ocprty_party = o.c and
    '01-MAY-11' between safp.effectivedate and safp.enddate and
    o.customerno = ? || ?
    order by sd.codeid
    where ISINT = 1
    parameters:
    DOC
    007492
    time: 344
    rows: 500
    query/performance
    evaltime: 359
    query/service
    result:
    *** removed due to length ***
    query/service
    function: getFeeCodeByCaregiverEffectiveDate1
    arity: 2
    dataservice: ld:org/wcb/claims/payment/FINEOS/physical/SQL.ds
    query:
    import schema namespace t1 = "http://www.test.com/claims/payment" at "ld:org/wcb/claims/payment/FINEOS/physical/schemas/SQL.xsd";
    declare namespace ns0="ld:org/wcb/claims/payment/FINEOS/physical/SQL";
    declare namespace ns1="http://www.w3.org/2001/XMLSchema";
    declare variable $__fparam0 as ns1:string external;
    declare variable $__fparam1 as ns1:string external;
    fn:subsequence(
    for $FeeCode3 in ns0:getFeeCodeByCaregiverEffectiveDate1($__fparam0,$__fparam1)
         return
                   $FeeCode3
    ,1,500)
    parameters:
    DOC
    007492
    common/time
    duration: 375
    timestamp: Thu May 12 13:10:00 GMT-06:00 2011
    [Thu May 12 13:10:00 GMT-06:00 2011] End
    ------------------------------------------------------------------------

Maybe you are looking for

  • The Downloads window doesn't display information since the last Firefox update

    I had to register a new help account just to get here. Your broser has been fucking up like crazy since the last update. I have been having nothing but problems logging into multiple sites. Sites would log me out randomly, then I wouldn';t be able to

  • How to convert a list of string of time (HH:MM:SS)to a numeric list for plotting

    my question is: How to transform a list of characters of values of time that have format HH:MMS to a list or adjustment of numerical values, to be able to use them in a code of LabVIEW? The numeric data are going to be used to plot them in a graph XY

  • MappingTool Warnings

    Hi, I'm getting the following warnings from the MappingTool when I run it against a existing database, that is created with out warning. For all tables Existing column "<Tables Primary Key Here>" on table "<Table Name Here>" is incompatible with the

  • Revoke Billing from WBS.

    Hi all, I am facing a problem looking for your help. I have a WBS element which is marked as Billing WBS, This WBS was assign to SO and billing plan was exist against it. Project is in release status. Now I want to change it back to act assgn only (n

  • Lenovo T500 Sound Card not detected

    Hey All, I'm having trouble with lenovo sound drivers since I just did a fresh install of windows 7 onto my T500. The audio worked before this reinstall and as soon as i did it, the sound stopped. The issue seems to be that there is no audio device a