ROWID Use in PL/SQL

Hi,
I'm using oracle 9.2.0.3. I have procedures that being called by VB component. The first procedure select fields from table including the ROWID. Then, the component disconnect from the database use the information to process other things. When the component is done with another process, it connects again to the database and calls the second procedure to delete the data by using the ROWID.
The reason that I did not create index for this table because every two minutes the table are heavily transacted (meaning there are inserts, updates and deletes). Thus, using the ROWID will save me some overhead.
Is this the correct approach or not? Is the ROWID changes in different session? When is the ROWID gets change?
Thanks in advance.

Never ever use ROWID across transactions, particularly if you are disconnecting and re-connecting. If your table is very active, it is entirely possible that your VB procedure can get a rowid and disconnect to do its processing. While Vb is processing, another process deletes the row you have grabbed. A third process inserts an entirely new row. Oracle may re-use the newly vacant space in the block to accomodate this new row. It will have the same ROWID as the row your VB process got. When your VB process deletes by rowid you will delete this new row. Probably not what you wanted.
If you really must use the rowid approach, then the only safe way to delete or update is something like:
DELETE FROM t
WHERE rowid = vb_rowid AND
      col1 = vb_col1 and
      col2 = vb_col2 and
      coln = vb_colnYou should create at least a primary key index on the table.
John

Similar Messages

  • Level of local SQLCE/other DB support in windows phone 8.1/using linq to sql from dll?

    I have had a mixed opinion for SQLCE support in windows phone 8/8.1. Is their still support for a local SQLCE or other database in windows phone 8.1? (A lot of different blog articles created their own handlers it appears and one used
    an visual studio app called SQLmetal) I am hoping to at least figure out the libraries to use for Linq to SQL in windows phone 8.1 in order to access a local Database. I only need to retrieve data from a simple Database with one -
    two tables and one of the tables has three fields.
    I wish to access the local DB from a dll file even if I have to use Linq to SQL. The reason for this is to store data for a simple game while the app is running. However, I may need to send data to the database and would like to separate that
    from the main application if possible. The only other question is: how do I add local database support to a dll file in windows phone 8.1? (This is my main objective but I need to know my database options first)
    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering
    - Yoda. Blog - http://www.computerprofessions.co.nr

    Windows Phone Silverlight 8.1 apps can still use LINQ to SQL (System.Data.Linq) see:
    http://msdn.microsoft.com/en-us/library/windows/apps/hh202860(v=vs.105).aspx
    For Windows Phone 8.1 [runtime] app you would need to use an external library like
    SQLite 
    There is a jumpstart training talk on using SQLite in Windows Phone 8.1 apps here:
    http://channel9.msdn.com/Series/Building-Apps-for-Windows-Phone-8-1/19
    I'm not sure what you mean by: "...access the local DB from a dll file..."  Do you mean you want the library used to access the database to be portable across
    platforms?
    Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast
    your votes for existing suggestions.
    I saw the first link and I think I have already been through some of that tutorial on channel 9 already.
    I'm not sure what you mean by: "...access the local DB from a dll file..."  Do you mean you want the library used to access the database to be portable across platforms?
    This would be a yes. I need use it to submit an application to the store (I wish to have the data and business logic in the dll file while having the GUI separate). I am currently using the portable dll but if you think using another dll type would help
    I will try that. I am a VB.NET programmer and so I can see where some programmers get their worries about SQLCE (It seems a lot of VB and VB.NET programmers like it from my time helping on the VB.NET forums second to SQL Server only).
    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering
    - Yoda. Blog - http://www.computerprofessions.co.nr
    Nevermind, I changed the dll type to "Silverlight" and I can use the System.Data.Linq reference at least.
    Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to
    suffering - Yoda. Blog - http://www.computerprofessions.co.nr

  • The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can be used to execute SQL statements.

    Hello All,
    I am getting below error can you please help me
    Error:-
    The transaction associated with the current connection has completed but has not been disposed. The transaction must be disposed before the connection can be used to execute SQL statements.

    Perhaps this thread will help you out
    http://stackoverflow.com/questions/11453066/error-the-transaction-associated-with-the-current-connection-has-completed-but
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Use a manual SQL query in an interface

    Hello,
    I would like to know if I can use a manual SQL query in an interface.
    Here is what I need.
    I have two tables.
    T1 with 4 fields :
    idT1, LibC, val, lib_val
    An example of a line from T1
    1, field1, 33 , value 33
    2, field2, 44 , value 44
    And table T2 with fields such as:
    idT2, ... , field1, field2
    There is no key to join T1 and T1, but I should retrieve the value of field lin_val from T2 which corresponds to the value of field1.
    In SQL, the query looks like this:
    SELECT t2.lib_val
    FROM t2 , t1
    WHERE T2.LibC = "Column_name"
    AND T2.val = T1.Column_name
    AND t1.idT1 = xyz

    You should go for yellow interface.It will solve your problem. Here you go
    http://odiexperts.com/how-to-create-a-temp-table-in-odi-interface/
    https://blogs.oracle.com/warehousebuilder/entry/odi_11g_simple_flexible_powerful
    Thanks.

  • Function which returns multiple values that can then be used in an SQL Sele

    I'd like to create a function which returns multiple values that can then be used in an SQL Select statement's IN( ) clause
    Currently, the select statement is like (well, this is a very simplified version):
    select application, clientid
    from tbl_apps, tbl_status
    where tbl_apps.statusid = tbl_status.statusid
    and tbl_status.approved > 0;
    I'd like to pull the checking of the tbl_status into a PL/SQL function so my select would look something like :
    select application, clientid
    from tbl_apps
    where tbl_apps.statusid in (myfunction);
    So my function would be running this sql:
    select statusid from tbl_status where approved > 0;
    ... will return values 1, 5, 15, 32 (and more)
    ... but I haven't been able to figure out how to return the results so they can be used in SQL.
    Thanks for any help you can give me!!
    Trisha Gorr

    Perhaps take a look at pipelined functions:
    Single column example:
    SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(32767);
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
      2      l_idx    PLS_INTEGER;
      3      l_list   VARCHAR2(32767) := p_list;
      4      l_value  VARCHAR2(32767);
      5    BEGIN
      6      LOOP
      7        l_idx := INSTR(l_list, p_delim);
      8        IF l_idx > 0 THEN
      9          PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
    10          l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
    11        ELSE
    12          PIPE ROW(l_list);
    13          EXIT;
    14        END IF;
    15      END LOOP;
    16      RETURN;
    17    END SPLIT;
    18  /
    Function created.
    SQL> SELECT column_value
      2  FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
    COLUMN_VALUE
    FRED
    JIM
    BOB
    TED
    MARK
    SQL> create table mytable (val VARCHAR2(20));
    Table created.
    SQL> insert into mytable
      2  select column_value
      3  from TABLE(split('FRED,JIM,BOB,TED,MARK',','));
    5 rows created.
    SQL> select * from mytable;
    VAL
    FRED
    JIM
    BOB
    TED
    MARK
    SQL>Multiple column example:
    SQL> CREATE OR REPLACE TYPE myrec AS OBJECT
      2  ( col1   VARCHAR2(10),
      3    col2   VARCHAR2(10)
      4  )
      5  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
      2  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
      2    v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
      3    v_obj myrec := myrec(NULL,NULL);
      4  BEGIN
      5    LOOP
      6      EXIT WHEN v_str IS NULL;
      7      v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
      8      v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
      9      IF INSTR(v_str,',')>0 THEN
    10        v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
    11        v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
    12      ELSE
    13        v_obj.col2 := v_str;
    14        v_str := NULL;
    15      END IF;
    16      PIPE ROW (v_obj);
    17    END LOOP;
    18    RETURN;
    19  END;
    20  /
    Function created.
    SQL>
    SQL> create table mytab (col1 varchar2(10), col2 varchar2(10));
    Table created.
    SQL>
    SQL> insert into mytab (col1, col2) select col1, col2 from table(pipedata('(1,2),(2,3),(4,5)'));
    3 rows created.
    SQL>
    SQL> select * from mytab;
    COL1       COL2
    1          2
    2          3
    4          5

  • How to set client within SQL statement without using another pl/sql stmt.

    I have a following select statement
    SELECT SUM (w.prior_forecasted_costs + w.prior_committed_costs)
    FROM xxsuf.job_cost_summary_table w,
    apps.pa_periods p,
    pa.pa_resources bz,
    pa.pa_resource_list_members cz,
    pa.pa_tasks dz
    WHERE w.project_id = z.project_id
    AND w.task_id = dz.task_id
    AND dz.task_number '98000'
    AND w.resource_list_member_id = cz.resource_list_member_id
    AND cz.resource_id = bz.resource_id
    AND NOT EXISTS (SELECT NULL
    FROM pa.pa_tasks zz
    WHERE zz.parent_task_id = dz.task_id)
    AND w.resource_list_member_id != 1000
    AND p.period_name = w.pa_period
    AND p.current_pa_period_flag = 'Y'
    Above select statement uses pa_periods view which only works when I set my client using "exec DBMS_Application_Info.set_client_info(83);" in Toad or SQL*Plus session.
    I was wondering how can I achieve it within select statement. so that I don't have to use another PL/SQL statement to set my client. Is there anyway to set client with my org id within above select statement ?
    Please advise.
    --Rakesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    You can simply create a function which calls dbms_application_info and use that in your sql statement as in
    SQL> create or replace function set_client_info (i_info varchar2)
       return varchar2
    as
    begin
       dbms_application_info.set_client_info (i_info);
       return i_info;
    end set_client_info;
    Function created.
    SQL> create or replace view v_emp
    as
      select * from emp where empno = to_number(sys_context('userenv','client_info'))
    View created.
    SQL> select ename from v_emp where set_client_info(7788) is not null
    ENAME    
    SCOTT    
    1 row selected.
    SQL> select ename from v_emp where set_client_info(7900) is not null
    ENAME    
    JAMES    
    1 row selected.

  • Can a report be developed using free hand SQL(Sql Query) using a DB Link

    Hello All,
    A report to be developed based on query in OBIEE dashboards
    Select Query -----1
    UNION
    Select Query------2
    First select query is coming from one database schema and second is coming from the other.
    Is there any way to develop the report using free hand SQL based on a DB link?
    Is there any feature to use Database link (DB link)?
    Thank in Advance,
    SMA

    What you ask is the direct database request capabilities :
    http://gerardnico.com/wiki/dat/obiee/presentation_service/obiee_direct_database_request
    But you can also use the federated query capabilities of the repository to model a star schema with two star schema from two different data source.
    Cheers
    Nico

  • Using Parameters in SQL-Query not only in where clauses

    Hi,
    I try to use Publisher parameters in the SQL Query from a Data Set.
    All of them have default values.
    So far, this is no problem, unless I try to use such a parameter value as an ordinary attribute value:
    >
    select
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."BETR_TEIL"
                                            else :pv_some_Text end                                                                  as Betr_Teil,
         case when (:pv_Group = 'no') then "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM"
                                            else :pv_some_Text end                                                        as Suva_Nr,
         case when (:pv_Group = 'no') then "DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH"
                                            else sum("DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") end      as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in (:pv_nim100)
         fetch first 65001 rows ONLY
    >
    The parameters 'pv_Group' and 'pv_nim100' are working fine. (when or where clauses)
    The parameter 'pv_some_Text' unfortunately not. (simple literals)
    When I try to validate the above SQL, I get the following Error:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46033] Datatype: 25 is not supported.
    </font>
    After use a cast function:
    >
    else CAST(:pv_some_Text AS CHARACTER)
    >
    I get this ERROR:
    <font color="red">
    java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 19002] Incorrect use of parameters. The parameters used in CAST cannot be resolved without ambiguity.
    </font>
    We use OBIEE 11.1.1.6.4 on a Win64-System.
    Thank's for any help.

    Hi Alex,
    let's leave away any unnecessary details.
    This is the SQL, inserted in the window 'Edit Data Set' of BIP Data Model:
    >
    select
         '--1'     as Betr_Teil,
         '--2'      as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    Everything is fine when I click OK, the script goes back to the metadata.
    Let's try this script with bind values in ORACLE SQL Developer.
    This SQL is the physical part, found in the OBIEE-Log (Log level 5), except the bind values. Therefore we find, in the where clause, the join. In the logical sql, we don't have to join, because it's handled in the Common Enterprise Information Model (CEIM)
    >
    with
    sawith0 as
    select
    sum(t39617.ris_vollbesch) as c1
    from
    dm15d_betriebsteil t39455,
    dm15k_ris_fakten_pro_btt_jhr t39617
    where
    t39455.id_betriebsteil = t39617.id_betriebsteil
    and t39455.suva_nr_form = '122-4.4'
    select
    d1.c1 as c1,
    d1.c2 as c2,
    d1.c3 as c3
    from
    select
    :pv_some_text as c1,
    :pv_some_text as c2,
    sum(d1.c1) as c3
    from
    sawith0 d1
    d1
    where
    rownum <= 65001
    >
    This SQL works fine, even with bind values for 'pv_some_text'.
    But, when using the following SQL in the BIP Data Model:
    >
    select
         :pv_Text as Betr_Teil,
         :pv_Text as Suva_Nr,
         sum("GDWH05"."DM15K_RIS_FAKTEN_PRO_BTT_JHR"."RIS_VOLLBESCH") as Vollbesch
    from "GDWH05"
    where
         "DM15D_BETRIEBSTEIL"."SUVA_NR_FORM" in ('122-4.4')
         fetch first 65001 rows ONLY
    >
    The following ERROR occurs:
    <font color="red">java.io.IOException: prepare query failed[nQSError: 43113] Message returned from OBIS. [nQSError: 46008] Internal error: File server\Query\Optimizer\ServiceInterfaceMgr\Utility\Src\SQOIUTypeVisitor.cpp, line 643.</font>
    In my opinion, either I use a wrong syntax, or BIP has a problem with parsing the script.
    Thank you for your most welcome help.

  • How to load decimal values into a file using bcp in SQL Server 2000?

    Hi everyone,
    I'm trying to load data from a database table to a text file using bcp on SQL Server 2000. When I'm loading the decimal values, the values before the decimal are not being loaded into the file. How could I load the values before decimals?
    Here are the DDLs and DMLs of what I'm trying to run:
    CREATE TABLE [dbo].[Product_Sales](
    [Year_of_Sale] [smallint] NOT NULL,
    [Product_Type] [varchar](25) NOT NULL,
    [Product_Group] [varchar](25) NOT NULL,
    [Category_Type] [varchar](25) NOT NULL,
    [Category_Group] [varchar](10) NOT NULL,
    [Product_Count] [bigint] NOT NULL,
    [Product_Amount] [decimal](19, 2) NOT NULL,
    [Category_Count] [bigint] NOT NULL,
    [Category_Amount] [decimal](19, 2) NOT NULL,
    CONSTRAINT [PK_Product_Sales] PRIMARY KEY CLUSTERED
    [Year_of_Sale] ASC,
    [Product_Type] ASC,
    [Product_Group] ASC,
    [Category_Type] ASC,
    [Category_Group] ASC
    ) ON [PRIMARY]
    ) ON [PRIMARY]
    INSERT INTO [Yearly_Sales].[dbo].[Product_Sales]
    VALUES(2010, 'Online', 'Web', 'Cameras', 'Electronics', 547, 0.00, 0, 0.00)
    EXEC [master].[dbo].[xp_cmdshell] 'bcp "SELECT * FROM [Yearly_Sales].[dbo].[Product_Sales]" queryout D:\Yearly_Sales\Product_Sales.dat -c -T -S'
    And the output I see in the file is:
    2010 Online Web Cameras Electronics 547 .00 0 .00
    The values before decimals are being truncated.
    Thanks,
    Bangaaram
    Known is a DROP, Unknown is an OCEAN.

    You can modify the decimal column(s) in the table to varchar type before export. But it does not look good.
    alter table [dbo].[Product_Sales]
    Alter column [Product_Amount] varchar(20)
    alter table [dbo].[Product_Sales]
    Alter column [Category_Amount] varchar(20)
    Does that make any sense?
    Known is a DROP, Unknown is an OCEAN.
    Basically you modify the decimal column to a varchar type before you run the bcp command for export. You can modify your source table or you can modify them on the fly. It is just a workaround.
    Modifying the source wouldn't be a good idea. Never do that if you can't get your desired output.
    Known is a DROP, Unknown is an OCEAN.

  • Calling a document style web service using a pl/sql wrapper method

    Just wanted to find out if anybody has a working example of invoking a document style web service from Oracle 10g database on a Unix environment.
    We have java test class that invokes the web service, and we are trying to use a pl/sql wrapper to invoke a Java Web Service client. So far, we are encountering an End of File Communication error from Oracle which essentially terminates the session with the database.
    On the Oracle application server side we are able to see a successful HTTP request made to the application server via server log, which is hosting the web service, since we are registering HTTP 200 success codes. However, we do not see any other errors from the application in the server logs. Most likely since the client side fails, before actually getting a chance to invoke the web service. This has been verified by commenting the client code leaving the print statements. The first call to the Service Factory method (XFire) to look up the service is where the PL/SQL procedure fails with an End of File communication error.

    Remove the when others section and see the actual error and post that.
    http://tkyte.blogspot.com/2008/06/when-others-then-null-redux.html
    http://tkyte.blogspot.com/2007/03/dreaded-others-then-null-strikes-again.html

  • How to write a file using mod pl/sql

    hi,
    i am having a submit button in my procedure. which should inturn create .sql file in a file path.
    is there any way to create a fileusing htp and htf methods.
    Thanks in advance
    Hari

    >
    i am having a submit button in my procedure. which should in turn create .sql file in a file path.
    is there any way to create a file using htp and htf methods.
    >
    Why are you wasting your time coding from scratch using the PL/SQL Web Toolkit instead of the APEX framework?
    From Re: how to write a file using mod pl/sql it appears that you are not using APEX, so a number of the approaches APEX offers are not relevant. You appear to be looking for a file download solution using the <tt>wpg_docload.download_file</tt> method, such as:
    create or replace procedure download_file (
        p_filename  in     varchar2
      , p_mimetype  in     varchar2
      , p_content   in out nocopy blob)
    is
    begin
      -- Set up HTTP header.
      -- Use "application/octet" as default MIME type.
      owa_util.mime_header(nvl(p_mimetype, 'application/octet'), false);
      -- Set the size so the browser knows how much to download.
      htp.p('Content-length: ' || dbms_lob.getlength(p_content));
      -- Filename will be used as default by the browser in "Save as..."
      htp.p('Content-Disposition: attachment; filename="' || p_filename || '"');
      -- Close header.
      owa_util.http_header_close();
      -- Stream the file content to the browser.
      wpg_docload.download_file(p_content);
    end download_file;

  • How to manage a "nice" url if APEX uses web pl/sql and not Apache?

    Hi all,
    How can I create a pretty url without using redirects or frames since APEX is using web pl/sql and not Apache? This is on version 4.0.1. We want the users to access the Apex App from a nice url without the traditional long url.
    Thanks,
    Veena.

    How can I create a pretty url without using redirects or frames since APEX is using web pl/sql and not Apache? This is on version 4.0.1. We want the users to access the Apex App from a nice url without the traditional long url.Hi,
    check out the last part of this blog post:
    http://ora-00001.blogspot.com/2009/07/creating-rest-web-service-with-plsql.html
    - Morten
    http://ora-00001.blogspot.com

  • ORacle sales analyzer doesn't display sql's using show sq.sql.stmts

    Hi,
    I cannot view the sql statements generated by Oracle Sales analyzer cube using show sq.sql.stmts.
    Moreover when I check on db I don't see any sql's being issued by web OSA session.
    What could be the possible reason for this?

    Lang wrote:
    Hi
    Can anyone help please, I am using SQL developer 3.0, and I have come across a lot of cases that after compiling a package , the compiler doesn't show me any errors, and It shows me the package is compiled , but it 's not valid after I close down the sql developer and log back in again.
    I am using 11g instantclient with it.Really?
    & here I thought SQL Developer used JDBC Thin to connect to the DB.

  • Where is HTTP access and error log when using Embedded PL/SQL Gateway?

    Hello,
    I am using Embedded PL/SQL Gateway to run stored procedures.
    I can't find access log and error log (something like Oracle HTTP Server has).
    In listener.log are only simple data and there are no usernames and procedure names...
    Thanks.
    Marian

    You might be better off asking this on the Apex forum: Oracle Application Express (APEX)

  • Use of native SQL-select statment

    hi,
    in my z-abap i use a native sql, saying the following:
    EXEC SQL.
      select agzdau into :gf_agzdau from APZD08/AG
                    where AGMAID = '77732' and
                          AGJAHR = 2008 and
                          AGMON  = 09 and
                          AGSPAL = 'ZASALD'
                          %_HINTS AS400 'HARD_CLOSE'
    ENDEXEC.
    before that i make a connection to the server where the table is stored.
    APZD08 is the library and AG is the filename (on a AS/400-machine)
    BUT: the file is not always in APZD08-lib, it depends on the employee.
    how can i make the lib-name and file flexible:
    i have tried it with
    select...............from :gf_file
    and i have put a value for gf_file before.
    but with that i got an SQL-error -104 when executing.
    i can't use a hostvariable there it seems.
    any ideas ?
    reg, Martin

    Hi.
    I would use ADBC instead of EXEC SQL. Then you can concatenate the SQL statement in the way you want it. But in that case you should use host variables in the where condition to get better performance.
    So something like the following (untested, no syntax check yet, pseudo code...):
    DATA: p_con_name   TYPE dbcon-con_name,
          p_con_ref    TYPE REF TO cl_sql_connection,
          p_stmnt      TYPE REF TO cl_sql_statement,
          p_result_set TYPE REF TO cl_sql_result_set,
          query        TYPE string.
    p_con_ref = cl_sql_connection=>get_connection( 'YOURCON' ).
    LOOP AT it_employees
    * CASE your logic
    CONCATENATE 'select agzdau from '  table_name
                'where  AGMAID = ? and AGJAHR = ?'
           INTO statement SEPARATED BY SPACE.
    * ENDCASE
    TRY.
      p_stmnt = p_con_ref->create_statement( ).
      GET REFERENCE OF p_agamaid INTO p_paramref.
      p_stmnt->set_param( p_paramref ).
      GET REFERENCE OF p_agjahr INTO p_paramref.
      p_stmnt->set_param( p_paramref ).
      p_result_set = p_stmnt->execute_query( query ).
      GET REFERENCE OF gf_agzdau INTO p_resultref.
      p_result_set->set_param( p_resultref ).
      p_result_set->next( ).
      CATCH CX_SQL_EXCEPTION.
    * error handling needed!
      ENDTRY.
    ENDLOOP.
    p_con_ref->close( ).
    Oh, I was assuming that there is only one result. If there can be more (and better style anyway) do a while-loop until next( ) is different from zero.
    Best regards,
    Jan

Maybe you are looking for