Table list for select statment

hello all,
I been trying to setup a plsql statment to run a select statment from tables that are in a list.
this is what I have done so far as a test and it is not letting me do it and I don't know why can anyone point me in the right direction.
declare
cursor main_log is
select *
from joseph_w.table_name_list;
cml main_log%rowtype;
var1 varchar2(35);
var2 varchar2(35;
begin
open main_log;
fetch main_log into cml;
var1 := cml.schema_name;
var2 := cml.table_name;
select *
from var1.var2;
close main_log;
end;
thanks

In PL/SQL you cannot just "select", as PL/SQL is a server sided language. You must use a record or variable to hold the selected data. Anyway, for selecting from different tables dynamically, you can use (Native) Dynamic SQL or Ref Cursors. Take a look at the documentation, especially the "PL/SQL User's Guide and Reference":
http://www.oracle.com/pls/db102/portal.portal_db?selected=1
Regards,
Gerd

Similar Messages

  • Restrict number of characters in table field for select statement.

    SELECT * FROM table
                    WHERE  column1  = z-column.
    The field column1 is of  type char and size 20
    The field z-column is of type char size 10.
    how do we perform this select?
    Anyone can guide me?
    Edited by: Hadesfx on Sep 11, 2009 3:56 PM
    Edited by: Hadesfx on Sep 11, 2009 3:59 PM

    Hello,
    In your OP did you mention this? Please be specific when you post the next time.
    Can you please post your code?
    I think you have to try a work around:
    DATA:
    RS_STOCKID TYPE SELOPT,
    RT_STOCKID TYPE STANDARD TABLE OF SELOPT.
    LOOP AT GT_ZB1PUT_STOCKTMP.
    RS_STOCKID-SIGN = 'I'.
    RS_STOCKID-OPTION = 'EQ'.
    RS_STOCKID-LOW = GT_ZB1PUT_STOCKTMP-STOCKID.
    APPEND RS_STOCKID TO RT_STOCKID.
    CLEAR RS_STOCKID.
    ENDLOOP.
    You can use this RANGE table to SELECT data from the table.
    SELECT * FROM zb1xxt_param
                FOR ALL ENTRIES IN gt_zb1put_stocktmp[]
                WHERE zzcode    = 'DEV036'
                AND   zzdomain  = 'SD'
                AND   zzdata    = 'INBOUND'
                AND   zzinput1  = 'STOCKID'
                AND   zzinput2  IN RT_STOCKID. "Use RT_STOCKID for SELECT'ing data
    BR,
    Suhas

  • How to assign table name for select query in loop.

    Hi friends my requirement is count the no of records of all the database table which comes into an internal table ."Check the below coding". Iam  fetching the tables from dd03l table into an internal table .plz give me a sujjesion how to assign a table name in select query  in a loop.
      SELECT tabname FROM dd09l
                INTO TABLE i_dd09l
                WHERE protokoll = 'X'.
      IF sy-subrc = 0.
        SORT i_dd09l BY tabname.
      ENDIF.
      LOOP AT i_dd09l.
        SELECT COUNT(*) INTO val FROM i_dd09l-tabname.
        IF sy-subrc = 0.
          i_dd09l-count = val.
        ENDIF.
        MODIFY i_dd09l INDEX sy-index.
        CLEAR val.
      ENDLOOP.
    error : 'I_DD09L-TABNAME' is not defined in the abap dictionary as a table.

    data: dy_table type ref to data,
          dy_line type ref to data,
          xfc type lvc_s_fcat,
          ifc type lvc_t_fcat,
          dy_field type ref to data.
    LOOP AT i_dd09l.
    perform get_structure using i_dd09l-tabname .
    CREATE DATA dy_table TYPE TABLE OF (_dd09l-tab_name).
        UNASSIGN <dyn_table>.
        ASSIGN dy_table->* TO <dyn_table>.
    SELECT COUNT(*) INTO val FROM <dyn_table>.
    IF sy-subrc = 0.
    i_dd09l-count = val.
    ENDIF.
    MODIFY i_dd09l INDEX sy-index.
    CLEAR val.
    ENDLOOP.
    form get_structure using p_table.
      data : idetails type abap_compdescr_tab,
      xdetails type abap_compdescr.
      data : ref_table_des type ref to cl_abap_structdescr.
    Get the structure of the table.
      ref_table_des ?=
      cl_abap_typedescr=>describe_by_name( p_table ).
      idetails = ref_table_des->components.
      loop at idetails into xdetails.
        clear xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-inttype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        append xfc to ifc.
      endloop.
    endform.                    "get_structure
    Try like this hope it will work.
    Regards,
    madan.

  • 'F4IF_INT_TABLE_VALUE_REQUEST'  doest not show any list for selection

    hi sapiens ....
    i hav an issue ... i used a parameter for which F4 help was assigned using
    'F4IF_INT_TABLE_VALUE_REQUEST'  .... to this an internal table any return fields was given .. if v press F4  window is opening for seletion but no values in it ....
    plz do .. giv u r suggestion ....
    Report ZJA_TEST .
    parameters filepath(100) type c .
    at selection-screen on VALUE-REQUEST FOR filepath .
    types : begin of typ_filepath  ,
              name(10),
           end of typ_filepath .
    data :  it_filepath type table of typ_filepath  ,
            wa_filepath type typ_filepath .
    wa_filepath-name = 'temp'.
    append wa_filepath to it_filepath  .
    wa_filepath-name = 'source'.
    append wa_filepath to it_filepath  .
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
       DDIC_STRUCTURE         = ' '
         retfield               = 'NAME'
       PVALKEY                = ' '
        DYNPPROG               = SY-REPID
        DYNPNR                 = SY-DYNNR
        DYNPROFIELD            = 'FILEPATH'
       STEPL                  = 0
       WINDOW_TITLE           =
       VALUE                  = ' '
        VALUE_ORG              = 'S'
       MULTIPLE_CHOICE        = ' '
       DISPLAY                = ' '
       CALLBACK_PROGRAM       = ' '
       CALLBACK_FORM          = ' '
       MARK_TAB               =
    IMPORTING
       USER_RESET             =
       tables
         value_tab              = it_filepath
       FIELD_TAB              = ''
       RETURN_TAB             = ''
       DYNPFLD_MAPPING        = ''
    EXCEPTIONS
       PARAMETER_ERROR        = 1
       NO_VALUES_FOUND        = 2
       OTHERS                 = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    check with following code..
    DATA: l_option TYPE help_info-dynprofld,
    v_repid LIKE sy-repid.
    DATA: ls_dfies      TYPE dfies,
           lt_dfies      TYPE ddfields.
    l_option = 'p_action'.
    v_repid = sy-repid.
    CALL FUNCTION 'DDIF_FIELDINFO_GET'
       EXPORTING
         tabname              = 'DD30T'
         fieldname            = 'DDTEXT'
        LANGU                = SY-LANGU
        LFIELDNAME           = ' '
        ALL_TYPES            = ' '
        GROUP_NAMES          = ' '
        UCLEN                =
       IMPORTING
        X030L_WA             =
        DDOBJTYPE            =
         dfies_wa             =
        LINES_DESCR          =
       TABLES
         dfies_tab            = lt_dfies
        FIXED_VALUES         =
       EXCEPTIONS
         not_found            = 1
         internal_error       = 2
         OTHERS               = 3.
    IF sy-subrc = 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE lt_dfies INTO ls_dfies INDEX 1.
    ls_dfies-offset = 0.
    MODIFY lt_dfies FROM ls_dfies INDEX 1.
    ls_dfies-fieldname = 'ACTION_VALUE'.
    ls_dfies-scrtext_s = 'ActionValue'.
    ls_dfies-scrtext_m = 'ActionValue'.
    ls_dfies-scrtext_l = 'ActionValue'.
    ls_dfies-intlen    = 40.
    ls_dfies-leng      = 40.
    ls_dfies-outputlen = 20.
    INSERT ls_dfies INTO lt_dfies INDEX 1.
    **This function is called to provide the input help for the user.
    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
       EXPORTING
         retfield        = 'ACTION_VALUE'
         dynpprog        = v_repid
         dynpnr          = sy-dynnr
         dynprofield     = l_option
         window_title    = 'Select Action Value'
         value_org       = 'S'
         display         = ' '
       TABLES
         value_tab       = it_action_values
         field_tab       = lt_dfies
       EXCEPTIONS
         parameter_error = 1
         no_values_found = 2
         OTHERS          = 3.
    if sy-subrc = 0.
    endif.
    it will work...
    Thanks & Regards
    Raju Mummidi

  • Dynamic table name in select statment

    hai,
    Please help me....
    oracle 9i i am using.
    i have four tables abc_121,
    abc_122,
    abc_123,
    abc_124.
    i want to pick records from a table.table name should be prepared dynamically.
    i.e., i want to pick records from a quarter table of this year.(ex: abc_124). using sql statement only.
    i have tried..but i couldn't...... pls help me...

    ramadurga.v wrote:
    oracle 9i i am using.
    i have four tables abc_121,
    abc_122,
    abc_123,
    abc_124.
    i want to pick records from a table.table name should be prepared dynamically.
    i.e., i want to pick records from a quarter table of this year.(ex: abc_124). using sql statement only.Create a partition view. E.g.
    create or replace view abc as
    select * from abc_121
    union all
    select * from abc_122
    union all
    ...For the partition view approach to correctly work (doing "partition pruning"), you need to have a constraint on the column that identifies that partition.
    In other words, you cannot use the table name as an attribute to identifies its data content. Foe example, you can have tables YEAR2001_Q1 and YEAR2001_Q2. However, the year and quarter also need to be in the table itself - e.g. columns YEAR and QUARTER.
    For table YEAR2001_Q1, the YEAR column needs to have a check constraint that ensures it is always 2001. And a check constraint for column QUARTER to ensure that it is always 1.
    If these conditions are met, then a select from the partition view using +"where YEAR=2001 and QUARTER=2"+ will result in only table YEAR2001_Q2 to be used and not other tables like YEAR2001_Q1.
    See {message:id=10539404} for an example.

  • SNC- New field adding to the Purchase due list for selection criteria

    Hi SNC Experts,
    I have to Add new fields from the existing available fields from the configuration in the purchasing  due list and for PO over view selection criteria. I want to know the configuration spot where should I go and look for thew list of exisitng fields which are not displayed for the selection criteria.

    HI Lata,
    which version is the system running on? We have BSP UI in lower releases and WD UI in latest releases.
    Best Regards,
    Harsha Gatt

  • SMDIAG_WIZARD: no server listed for selected solution

    Hello,
    I am trying to set up SMD for our Enterprise Portal 6.0 on Netweaver 04. I have defined a solution which includes this system and also shows the correct server. But when I run SMDIAG_WIZARD and select this solution no server shows up in the next step. This is the first Java application I am integrating, so not sure if I missed anything.
    Thanks.

    Hi Frederic,
    thanks. The missing part was the definition of the System Component. The Server is now showing up.
    Thanks for your help,
    Ingrid

  • SELECT STATMENT USING JOINS OF 2 TABLE WITH UPT 200 ROWS

    Hi
         Any give me sample code for select statment'' SELECT STATMENT USING JOINS OF 2 TABLE WITH UPT 200 ROWS''.
    Thanks in advance .
    regards
    veera

    tables : mara.
    data : begin of itab occurs 0,
           matnr like mara-matnr,
           maktx like makt-maktx,
           end of itab.
    start-of-selection.
    select amatnr bmaktx into table itab up to 200 rows
            from mara as a inner join makt as b on bmatnr = amatnr.

  • Unable to view table list in sql developer

    I am able to connect to the database through sql developer but unable to view tables list.
    Select query is displaying the contents though.
    Any Help ???

    Using SQL Developer, I log in using the owner user id and password. I can see all but one of my materialized views. It was definitely created by the user id I'm logged in as. A query of user_objects in sql+ shows all MVs, including the one that's missing in SQL Developer. If I log in using the same credentials in TOAD, the MV is displayed in the current schema, as I'd expect. The super weird thing is that if I use the previous version of SQL Developer, I see that MV! Any thoughts?
    Edited by: [email protected] on Feb 25, 2009 9:19 AM

  • Unable to view table list

    I am able to connect to the database through sql developer but unable to view tables list.
    Select query is displaying the contents though.
    Any Help ???

    I am on Windows XP using SQLDeveloper Build 5440 and I am having a similar problem (I think).
    I am able to connect to the database, I am able to see a list of all the tables (as the owner) in the tree but i can not see anything under columns and am shown 5 all null rows under data. I am able to view statistics, DDL and I can query the table with a select and get results. I have tried reverting to an older versin of SQLDeveloper but that gave me the same result.
    If this is the same problem then I am having it too. Any help would be appreciated. Thanks in advance.
    Greg

  • Physical table list against Cluster Table CDPOS and PCDPOS

    Hello experts,
    For function customized requirement, we need to know the physical table
    list against Cluster Table CDPOS and PCDPOS and EDID4, just like
    Cluster Table BSEG contain with six physical tables
    BSAD/BSID/BSAS/BSIS/BSAK/BSIK. Also we want to know if there is any
    general way to find out the physical table list for any cluster table.
    My question is:
    1. How can I find all the transparent table for Cluster Table CDPOS?
    just like Cluster Table BSEG has transparent tables of
    BSAD/BSID/BSAS/BSIS/BSAK/BSIK.
    2. How can I find all the transparent table for Cluster Table PCDPOS?
    3. How can I find all the transparent table for Cluster Table EDID4?
    4. Additionally,I want to know if there is any
    general way to find out all the transparent tables for an specific
    cluster table.
    Many thanks.

    Hello,
    simply look in transaction SE11.
    Example:
    1.  SE11 -> Table CDPOS - Display. On Tab 'Delivery and Maintenance' you'll find Pool/Cluster 'CDCLS'.
    2. SE11 -> Table CDCLS -> Display. On next screen position on CDCLS-> Where-used-list -> Tables -> you'll find tables CDPOS and PCDPOS.
    Same thing with EDID4    -> EDI40 ...
    Regards Wolfgang

  • Getting list of selected Rows of a Table

    Hi Experts,
    Im having a table with 500 elements, among them i select few of them to process, for exmpl consider my table has 500 rows , where each row represents a Invoice Payment, among them only few i select and process those or reject those.
    Now my problem is here when i select 1 Inv payment  or 100 Inv Payments or 50 Inv Payments , i have to iterate throught the table node using for() loop to take the selected ones for processing, i.e i have to iterate 500 times, instead is there any single function that can give me only the list of selected elements, so iteration of 500 elements is avoided. So that performance is increased.
    Regards
    Govardan Raj S

    What you can do is use the onSelect event (fired when you click and select a row) to copy the row into another context node which is the same as your table context node. When you have selected all the records you want to process, then use the table which you copied the selected records to instead of the one which has 500 entries. Make sense?
    Kunal

  • Query to get objects list for which the current user has 'SELECT' privilege

    Hi,
    I want to get tables and views list for which the current user has 'SELECT' privilege excluding sytem tables and views. The privilege information for the current user is scattered in more than one system views. I have following system views
    USER_TAB_PRIVS_RECD - Object grants for which the current user is the grantee
    ROLE_TAB_PRIVS - describes table privileges granted to roles. Information is provided only about roles to which the user has access.
    If the object privilege is granted explicitly like "GRANT ALL ON TABLE_NAME TO "USERNAME" then this privilege entry goes to USER_TAB_PRIVIS_RECD
    If the object privilege is granted by ROLE. Role is created with certain object privileges. this role is assigned to user "GRANT ROLE_NAME TO "USERNAME"", then this entry goes to ROLE_TAB_PRIVS
    From these findings, I have composed below query
    (SELECT DISTINCT TABLE_NAME FROM USER_TAB_PRIVS_RECD) UNION (SELECT DISTINCT TABLE_NAME FROM ROLE_TAB_PRIVS WHERE PRIVILEGE = 'SELECT')
    Have I got user's all prvilege details? should I look some other system views?
    How to exclude system table privileges details?
    (SELECT DISTINCT TABLE_NAME FROM USER_TAB_PRIVS_RECD) UNION (SELECT DISTINCT TABLE_NAME FROM ROLE_TAB_PRIVS WHERE PRIVILEGE = 'SELECT' AND OWNER NOT IN ('SYS','SYSTEM') Is this right?
    What about Public role in Oracle? Should I consider public role here?
    Oracel Version :11g
    I want make this query to work on Oracle 8i or above version
    Thanks

    >
    I want to get tables and views list for which the current user has 'SELECT' privilege excluding sytem tables and views.
    >
    You will need a hierarchical query to do that.
    Try this script for Listing privileges recursively for Oracle users
    http://www.adp-gmbh.ch/ora/misc/recursively_list_privilege.html

  • Drop down list for a field in table maintainance

    Hi,
    I have created a table maintainance for ztable. I need a drop down list for field so that user can select values present in the list while giving entries.
    I can not use fixed values in domain, because feild length is more and it wont fit into fixed values.
    I am trying to use VRM_SET_VALUES FM but not getting output. Can any one help me on this.
    Thank you,
    Regards,
    Kusuma K.

    TYPE-POOLS: vrm.        Include this in your program
    DATA: l_name  TYPE vrm_id,
          l_list  TYPE vrm_values,
          l_value LIKE LINE OF l_list.
      LOOP AT it_paym INTO w_paym.
        l_value-key = w_paym-pay_method.
        l_value-text = w_paym-text.
        APPEND l_value TO l_list.
      ENDLOOP.
      l_name = 'Table-field'.   change it as per your requirement this has to be perfect
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = l_name
          values          = l_list
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Hope it helps you,
    Abhijit G. Borkar

  • Bizzare situation withn the "Where used list" for a table

    Hello all,
    I use the "where used list" (all check boxes selected) function in SE11 to find out where and how the table FMGLFLEXT (same for table FMGLFLEXA) is being used and updated. All I get is a reference to a function module, namely   “G_POSTING_FMGLFLEXT”. When I do a "where used list" (once again, all check boxes selected) for the FM, I get the message: Function Module G_POSTING_FMGLFLEXT not found in selected search area Message no. ES120“ despite the fact that all check boxes are selected.
    Yet this table contains data which were put in there via transaction FB50 (G/L Acct Pstg: Single Screen Trans.). So somehow, somewhere this data was created and put into the table.
    I don’t get it! What am I missing?
    Thank you for your help

    Old thread, but anyway: There is one more thing to do to get the complete where-used list:
    (1) Select all checkboxes in the "Used in" block (as you did, probably by using the button "Select All (F7)")
    (2) and use the button "Search Range" (quickinfo "Limit Search Range (F5)") -- although the following pop-up is called "Restrict hit lit" you will find there a checkbox "Search also in generated objects". In my case that's how I found a generated function module G_POSTING_Z.... in SAP's namespace but with customer db table name Z....

Maybe you are looking for

  • When downloading Itunes, keep getting system error, have had it on this computer before

    when downloading Itunes, keep getting system error, have had it on this computer before

  • Animation Performance and Optimization

    Hi, and thanks for reading in advance! I'm struggling with getting "smooth-enough" performance for a simple application I'm writing.  I was hoping someone could give some pointers.  Briefly my proof of concept application creates between 1 and 10 ind

  • Create oracle table from sql server

    Dear Gurus, I need to create some tables from sql server 2008 to a oracle 11g database. Some tables contain vbinary datatype. Now my queries are 1. How can I do that? 2. If DB link is a solution then would you please provide me a step by step process

  • Can't find palm tungsten isync hotsync conduit in leopard

    Attempting to sync my Palm Tungsten E2 with iCal & Address Book by USB but iSync can't set up when I attempt to Enable Palm Syncing. iSync Hotsync Conduit does not install and is not found on searching with Spotlight. Palm Hotsync works fine. Where i

  • ISE WLC 4400 configuration

    Up until now, my experience has been with 5500 controllers and ISE. My customer is using 4400 controller, on 7.0.240 code. I cannot locate any documents referencing 4400 controller configuration for webauth, named ACLs, posturing, etc... Does anyone