Using variable in physical table of type "select"

Hello!
I have to use query as physical table (in Administration tool - http://file.qip.ru/file/120930377/8713693/1_online.html):
SELECT ID, CODE
FROM TABLE (pkg.output('1','2')) This code works well. I need to insert instead of parameters '1' and '2' session variables, which will be set from Dashboard.
How to put variable in this query? Variants like @{test} don't work.

Hi
I have a working example:
select * from table(get_emps('VALUEOF(NQ_SESSION.USER)'))
where
CREATE OR REPLACE FUNCTION GET_EMPS(P_USER VARCHAR2:='SUPPLIER2')
RETURN EMP_TYPE_LIST
IS
EMPS EMP_TYPE_LIST:=EMP_TYPE_LIST();
R EMP_TYPE:=EMP_TYPE(NULL,NULL,NULL,NULL,NULL);
i pls_integer:=0;
CURSOR C_EMP(C_USER EMPLOYEES.USER_ID%TYPE) IS
SELECT EMPLOYEE_ID,FIRST_NAME,LAST_NAME,SALARY ,USER_ID
FROM EMPLOYEES WHERE upper(USER_ID)=upper(C_USER);
BEGIN
OPEN C_EMP(P_USER);
LOOP
FETCH C_EMP INTO R.EMPLOYEE_ID,R.FIRST_NAME,R.LAST_NAME,R.SALARY,R.USER_ID;
EXIT WHEN C_EMP%NOTFOUND;
i:=i+1; emps.extend; EMPS(i):=R;
END LOOP;
RETURN EMPS;
END;
and
CREATE OR REPLACE TYPE EMP_TYPE AS OBJECT
EMPLOYEE_ID NUMBER(6),
FIRST_NAME VARCHAR2(20),
LAST_NAME VARCHAR2(25),
SALARY NUMBER(8,2),
USER_ID VARCHAR2(30));
and
CREATE OR REPLACE TYPE EMP_TYPE_LIST AS TABLE OF EMP_TYPE;
My employees table contains an extra column, called user_id, which has different values: 'Administrator','SUPPLIER2' and so on
Best regards
Laszlo

Similar Messages

  • How to use bind variable value for table name in select statement.

    Hi everyone,
    I am having tough time to use value of bind variable for table name in select statement. I tried &p37_table_name. ,
    :p37_table_name or v('p37_table_name) but none worked.
    Following is the sql for interactive report:
    select * from v('p37_table_name') where key_loc = :P37_KEY_LOC and
    to_char(inspection_dte,'mm/dd/yyyy') = :P37_INSP_DT AND :p37_column_name is not null ;
    I am setting value of p37_table_name in previous page which is atm_state_day_insp.
    Following is error msg:
    "Query cannot be parsed, please check the syntax of your query. (ORA-00933: SQL command not properly ended) "
    Any help would be higly appreciated.
    Raj

    Interestingly enough I always had the same impression that you had to use a function to do this but found out from someone else that all you need to do is change the radio button from Use Query-Specific Column Names and Validate Query to Use Generic Column Names (parse query at runtime only). Apex will substitute your bind variable for you at run-time (something you can't normally do in pl/sql without using dynamic sql)

  • How to variable exit read table based on selected row on weblayout ??

    Hi All,
    Greeting,
    I have a question regarding IP.
    I have report where I can choose the line. I've already been able to catch the selected row there using ABAP Planning Function.
    The requirement is to change some value from other customized table ( not info cube ) based on selected row.
    So when user's selecting data and pressing a button, the idea is to prompt a variable where they can see the old value, and they can entry the new value. But to query that value, I need to select based on the values the row.
    My Question is how user-exit in variable can read selected row in web planning layout especially it happens when I_step = 1 ?
    Or the other idea is to get the value on that customized table and put it in text web item as the old value. How can I fetch data from table and put it in text web item ?
    Thanks a lot and have a good day,

    Hi.
    My Question is how user-exit in variable can read selected row in web planning layout especially it happens when I_step = 1 ?
    I think there is no way to do it. I_STEP=1 called before the report shows the data.
    But may be the next approach could help you:
    1. when you select line you can use command for populating variables according to selected line. let's say yohave selected line with costcenterr XXX so you can populate variable (let's say Z_CC) with selected value.
    2. create FOX that reads variable Z_CC value and calls any function module with customized table and variable value (you can use CALL FUNCTION statement within FOX and pass to it variable value).
    This is just an idea of some direction - may be you can take it and develope to required result.
    Regards.

  • Using variable as a table name

    hi i want to use a variable as table in plsql block
    like
    declare cursor c1
    select to_char(to_date(substr(appl_uid,21,2),'MM'),'MON')||'_'|| as v_Tab,ename from my_table;
    v_ename = varchar(55);
    vv_table =varchar(6);
    begin
    open c1
    fetch c1 into vv_table,v_ename
    select ename into v_ename from vv_table;
    DBMS_OUTPUT.PUT_LINE (v_ename);
    close c1
    end;
    please help me to correct this block

    As mentioned by BlueShadow above the following statement will fail if the table has more then one row.
    EXECUTE IMMEDIATE 'select ename from ' || vv_table INTO v_ename;So I would suggest you use ref curosr to execute a SELECT dynamically which is likely to return more then one row.
    SQL> create table my_table (appl_uid VARCHAR2(30),ename varchar2(30));
    Table created.
    SQL> insert into my_table values ('123456789012345678901234567890','SCOTT');
    1 row created.
    SQL> insert into my_table values ('123456789012345678901123456789','WARD');
    1 row created.
    SQL> create table nov_ (ename varchar2(30));
    Table created.
    SQL> insert into nov_ values ('SMITH');
    1 row created.
    SQL> insert into nov_ values ('JAMES');
    1 row created.
    SQL> insert into nov_ values ('JONES');
    1 row created.
    SQL> create table dec_ (ename varchar2(30));
    Table created.
    SQL> insert into dec_ values ('ALLEN');
    1 row created.
    SQL> insert into dec_ values ('ADAMS');
    1 row created.
    SQL> insert into dec_ values ('KING');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> set serveroutput on
    SQL> declare
      2        cursor c1 is
      3        select to_char(to_date(substr(appl_uid, 21, 2), 'MM'), 'MON') || '_' as v_tab,ename
      4        from my_table;
      5        type ref_cur is ref cursor;
      6        c2 ref_cur;
      7        v_ename   varchar(55);
      8  begin
      9        for rec in c1 loop
    10          open c2 for 'select ename from ' || rec.v_tab;
    11          DBMS_OUTPUT.PUT_LINE('********************'||rec.v_tab||'********************');
    12          loop
    13              fetch c2 into v_ename;
    14              exit when c2%notfound;
    15              DBMS_OUTPUT.PUT_LINE(v_ename);
    16          end loop;
    17          close c2;
    18        end loop;
    19 end;
    23 /
    ********************DEC_********************
    ALLEN
    ADAMS
    KING
    ********************NOV_********************
    SMITH
    JAMES
    JONES
    PL/SQL procedure successfully completed.And at last as suggested by fellow members that it is a bad idea, I would agree and suggest you to relook your design.
    Edited by: zahid79 on Jul 22, 2010 10:28 PM

  • Using variables to specify tables and columns in a function

    All,
    I'm trying to create a function to select a random table, random column, random row, and return the data. I'm not quite sure how to use the table_name once I have it stored in the variable and I'm hoping someone can help.
    Here is the code:
    create or replace function sknddstr (asdf in varchar2)
    return varchar2
    is
    v_table      varchar2(50);
    v_column      varchar2(50);
    v_data           varchar2(50);
    v_return      varchar2(160);
    begin
    select     asdf.table_name into v_table
    from     dual
    ,     (select     table_name
         from     user_tables
         where     table_name not like 'TEMP%'
         order by      dbms_random.random) asdf
    where     rownum < 2;
    select fdsa.column_name into v_column
    from     dual
    ,     (select column_name
         from     user_tab_cols
         where     table_name = v_table
         and     nullable = 'Y'
         order by     dbms_random.random) fdsa
    where     rownum < 2;
    select     v_column into v_data
    from     dual
    ,     (select v_column
         from     v_table
         order by dbms_random.random)
    where     rownum < 2;
    select v_table || ' | ' || v_column || ' | ' || v_data into v_return
    from dual;
    return v_return;
    end;
    Any suggestions? BTW, I know I don't use the IN asdf, but I'm not sure how to create a function with no parameters.
    Thanks again!

    You need to use dynamic SQL whenever you substitute object names (table, column, etc.) at runtime. I would suggest something like (note I have changed the filters to match my data):
    sql>create or replace function f_random_data
      2    return varchar2
      3  is
      4    v_table_name   user_tab_columns.table_name%type;
      5    v_column_name  user_tab_columns.column_name%type;
      6    v_data         varchar2(4000);
      7  begin
      8    select table_name, column_name
      9      into v_table_name, v_column_name
    10      from (select table_name, column_name
    11              from user_tab_columns
    12             where table_name = (select table_name
    13                                   from (select table_name
    14                                           from user_tables
    15                                          where table_name in ('EMP', 'DEPT')
    16                                          order by dbms_random.random)
    17                                  where rownum <= 1)
    18  --             and nullable = 'Y'                  
    19             order by dbms_random.random)
    20     where rownum <= 1;                                
    21 
    22    execute immediate
    23      'select *' ||
    24      '  from (select ' || v_column_name ||
    25              '  from ' || v_table_name ||
    26              ' order by dbms_random.random)' ||
    27      ' where rownum <= 1'
    28      into v_data;
    29 
    30    return (v_table_name || '|' || v_column_name || '|' || v_data);
    31  end;
    32  /
    Function created.
    sql>select f_random_data from dual;
    F_RANDOM_DATA
    EMP|COMM|500
    1 row selected.
    sql>/
    F_RANDOM_DATA
    DEPT|DNAME|SALES
    1 row selected.
    sql>/
    F_RANDOM_DATA
    DEPT|DEPTNO|40
    1 row selected.
    sql>/
    F_RANDOM_DATA
    EMP|ENAME|SCOTT
    1 row selected.
    sql>/
    F_RANDOM_DATA
    DEPT|DNAME|OPERATIONS
    1 row selected.

  • Using variable as schema / table names?

    Hello all -
    First time poster :)
    I would like to use PL SQL to do something like so
    --***************RUN MAIN******************
    DEFINE SCHEMA_NAME = 'SCHEMA_NAME' CHAR;
    DEFINE FINAL_TABLE = 'FINAL_TABLE ' CHAR;
    BEGIN
    SELECT DISTINCT COLUMN FROM SCHEMA_NAME.FINAL_TABLE
    END
    However this doesn't work. I've googled and found other ways like producing a prompt but those are always in the string to search for and not the name of the schema or table to run the SQL on. I am not sure if this is even possible. Any help would be appreciated.
    Thanks!
    Edited by: 813738 on Nov 19, 2010 11:02 AM

    Also I am running this in Oracle SQL Developer in the SQL Worksheet not in the commandline.
    This is the error I got.
    Error starting at line 3 in command:
    BEGIN
    CREATE OR REPLACE SYNONYM SCHEMA FOR BMSAPIX_GRPA_DEV.AE_CV185060_FINAL;
    SELECT DISTINCT COLUMN FROM _SCHEMA;
    END
    Error report:
    ORA-06550: line 2, column 3:
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
    ( begin case declare exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    continue close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe purge
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    Edited by: 813738 on Nov 19, 2010 1:10 PM Sensitive info

  • Using variables to build table names

    <p><font face="arial,helvetica,sans-serif" size="3">Hi, I&#39;m trying to build a report that I can easily adapt for different tables. For instance I have tables;</font></p><p><font face="arial,helvetica,sans-serif" size="3">cl_fra1_dynamic (France)</font></p><p><font face="arial,helvetica,sans-serif" size="3">cl_fra1_static (France)</font></p><p><font face="arial,helvetica,sans-serif" size="3">cl_ger1_dynamic (Germany)</font></p><p><font face="arial,helvetica,sans-serif" size="3">cl_ger1_static (Germany)</font></p><p><font face="arial,helvetica,sans-serif" size="3">cl_gbr1_dynamic (United Kingdom)</font></p><p><font face="arial,helvetica,sans-serif" size="3">cl_gbr1_static (United Kingdom) </font></p><p><font face="arial,helvetica,sans-serif" size="3">cl_usa1_dynamic (United States)</font></p><p><font face="arial,helvetica,sans-serif" size="3">cl_usa1_static (United States)</font></p><p><font face="Arial" size="3">and so on and on and on and on,</font></p><p><font face="Arial" size="3">All the reports I want to create are exactly the same apart from the table accessed.</font></p><p><font face="Arial" size="3">so in order to get data from  </font></p><p><font face="Arial" size="3">cl_fra1_dynamic.DATA and cl_fra1_static.VALUE I want to use something like, </font></p><p><font face="Arial" size="3"><a href="mailto:cl_{@country}1_dynamic.DATA">cl_{@country}1_dynamic.DATA</a> and <a href="mailto:cl_{@country}1_dynamic.VALUE">cl_{@country}1_dynamic.VALUE</a> where <a href="mailto:{@country">{@country</a>} = fra </font></p><p><font face="Arial" size="3">I hope Im not being to dopy. Quite new to all this - but I do know the database administrator needs shooting!</font></p><p>Im using Crystal 9.2</p><p><font face="Arial" size="3">Cheers,</font></p><p><font face="Arial" size="3">Andrew Holway</font></p>

    <p>Not sure if this will work in 9.2, as I only have CR XI. This is terribly messy, but if you can&#39;t change your data model to put all rows in one table and add a country column, then you can actually add an SQL command object that takes a parameter. Your SQL would be</p><p>select DATA, VALUE </p><p>from cl_{?country}1_dynamic, cl_{?country}1_static </p><p>where cl_{?country}1_dynamic.PKEY = cl_{?country}1_static.FKEY</p><p> </p><p>I think a better option would be to create two views... </p><p>create view dynamic as (select col1, col2, colN, &#39;FRA&#39; as country from cl_fra1_dynamic union select col1, col2, colN, &#39;GER&#39; as country from cl_ger1_dynamic union ...etc.)</p><p>and a corresponding view for the static tables. Use the views and you can use the select expert to limit the countries. </p><p> </p><p>If your DBA won&#39;t make the views for you, select from a derived table in a command object, i.e. make the views temporarily youself. </p>

  • Physical Tables based on select with parameters

    I have a database query that receives some input parameters and it worked fine when I run this query from any sql tool, The query is very complex and the input parameters are not associated in the sql to a specific column, they are associated in the subqueries that the query has.
    Is it possible create a view using the sys_context function and establish the parameters at runtime from business intelligence 10.1.3.4.1 ?
    Thanks!
    Ramiro Ortiz

    I believe this is what you are trying to get at:
    SELECT DECODE(m.pref_type, 1, (SELECT result FROM a
                                   WHERE a.pref_value = m.pref_value),
                               2, (SELECT result FROM b
                                   WHERE b.pref_value = m.pref_value)
    FROM my_table mAlthough, if the tables are large, that might be pretty slow. Better than an outer join, but one of those correlated queries is going to be run for each row in my_table. You could lso try something like:
    SELECT m.pref_type, r.result
    FROM my_table m,
         (SELECT 'A' tbl, pref_value, result
          FROM a
          UNION ALL
          SELECT 'B', pref_value, result
          FROM b) r
    WHERE DECODE(m.pref_type, 1, 'A', 'B') = r.tbl and
          m.pref_value = r.pref_valueHTH
    John

  • Table of type select-options

    Hi,
    I need to build an internal table which has the fields SIGN, OPTION, LOW, HIGH.
    I know there exists a standard database table with these 4 fields, but, am not able to recollect.
    Please post the table name here if you know.
    Thanks,
    David.

    Are you looking for this table -
    >TVARVC
    Alternatively,if u have the field name.
    You can use this declaration
    RANGES :r_matnr for mara-matnr. (or)
    DATA:r_matnr1 type range of mara-matnr.---->Internal table having components  SIGN ,OPTION,matnr-LOW,matnr-HIGH
    DATA:wa_matnr1 like line of r_matnr1.------->Work Area
    Regards,
    Lakshman.
    Edited by: Lakshman N on Oct 29, 2009 7:19 AM

  • Conditionaly select the physical table based on selection from prompt.

    Hi expert.
    we have one logical table with two LTS(LTS A and LTS B). LTS A is at day level and LTS B is at week level.
    So i have created a dashboard prompt which returns as day and week in drop down(SQL Result).
    So when we select Day it should run from the day table and when we select Week it should run from week table.
    How to do that...

    Amotoj,
    This scenario is exactly what the Cascade parent is meant for.   You would define your screen to have multiple fields where if you select a value in field 1, field 2 will be automatically filtered based on the first selection.
    You will need the appropriate indexes on the Complex Table to support it but it is fairly straight forward.
    If there a reason you don't want to use multiple fields?
    --Bill

  • OBIEE generated SQL differs if it's a Physical Table or Select Table...

    Hi!
    I have some tables defined in the Physical Layer, which some are Physical Tables and others are OBIEE "views" (tables created with a Select clause).
    My problem is that the difference in the generated SQL for the same table, differs (as expected) whether it is a Physical Table or a "Select Table". And this difference originates problems in the returned data. When it a Physical Table, the final report returns the correct data, but when it is a Select Table it returns incorrect/incomplete data. The report joins this table with another table from a different Database (it is a join between Sybase IQ and SQL Server).
    This is the generated SQL in the log:
    -- Physical Table generated SQL
    select T182880."sbl_cust_acct_row_id" as c1,
    T182880."sbl_cust_acct_ext_key" as c2,
    T182880."sbl_cust_source_sys" as c3
    from
    "SGC_X_KEY_ACCOUNT" T182880
    order by c2, c3
    -- "Select Table" generated SQL
    select
         sbl_cust_acct_ext_key,
         ltrim(rtrim(sbl_cust_source_sys)) as sbl_cust_source_sys,
         sbl_cust_acct_row_id,
         sbl_cust_acct_camp_contact_row_id,
         ods_date,
         ods_batch_no,
         ods_timestamp
    from dbo.SGC_X_KEY_ACCOUNT
    As you may notice, the main difference is the use of Aliases (which I think that it has no influence in the report result) and the use of "Order By" (which I start to think that it its the main cause to return the correct data).
    Don't forget that OBIEE server is joining the data from this table, with data from another table from a differente database. Therefore, the join is made in memory (OBIEE Engine). Maybe in the OBIEE Engine the Order by is essential to guarantee a correct join...but then again, I have some other tables in the Physical Layer that are defined as "Select" and the generated SQL uses the aliases and the Order by clause...
    In order to solve my problem, I had to transform the "Select Table" into a "Physical Table". The reason it was defined as a "Select Table" was because it had a restriction in the Where Clause (which I eliminated already, althouth the performance wil be worse).
    I'm confused. Help!
    Thanks.
    FPG

    Hi FPG,
    Not sure if this is a potential issue for you at all, but I know it caused me all kinds of headaches before I figured it out. Had to do with "Features" tab Values in the database object's settings in the Physical Layer:
    Different SQL generated for physical table query vs. view object query?
    Mine had to do with SQL from View objects not being submitted as I would expect, sounds like yours has more to do with "Order By"? I believe I remembered seeing some Order By and Group By settings in the "Features" list. You might make a copy of your RPD and experiement around with setting some of those if they aren't already selected and retesting your queries with the new DB settings.
    Jeremy

  • Creating Physical table as select in the .rpd

    When creating a physical table as a select we can write the SQL statement like SELECT A,B,C... FROM xxx etc.
    Trouble is that we then have to go the tab COLUMNS and define each column... This is kind of very error prone and lots of work...
    Pls. is there a way to somehow leverage the columns alreaday defined in the PHYSICAL TABLE ?
    Txs. for any help.
    Antonio

    Hi Antonio,
    You didnt catch me..
    1)Open actual rpd and create a view using select query, do not add any columns.
    2) Create view in dev db.
    3) Create a new rpd file import the view into the physical layer.
    4) Select columns from step3 and copy
    5) paste in the actual rpd on selecting the 'select query' object
    you are good to go.
    This wold help you with all columns and their datatypes.
    Hope this helps.
    Cheers,
    SVee

  • Using variables as table names. Ideas for alternative designs

    Hi,
    I am designing an application which uses synonyms to pull information from 'client' DBs via DB Links. The synonyms are created with a DB_ID in the name (example: CUSTOMER_100, CUSTOMER_200... where 100 and 200 are DB IDs from 2 separate client DBs.
    I have a procedure which selects data from the synonym based on what DB_ID is passed to the procedure. I want to be able to run this one procedure for any DB_ID that is entered. I am now aware I cannot use variable names for table names and using EXECUTE IMMEDIATE doesnt seem to fit for what I am trying to do.
    Does anybody have any suggestions or re-design options I could use to achieve this generic procedure that will select from a certain synonym based on the DB info input parameters? Thanks.
    CREATE OR REPLACE PROCEDURE CUSTOMER_TEST(p_host IN VARCHAR2, p_db_name IN VARCHAR2, p_schema IN VARCHAR)
    IS
       v_hostname     VARCHAR2 (50) := UPPER (p_host);
       v_instance     VARCHAR2 (50) := UPPER (p_db_name);
       v_schema     VARCHAR2 (50) := UPPER (p_schema);
       v_db_id  NUMBER;  
       v_synonym VARCHAR2(50);
       CURSOR insert_customer
       IS
         SELECT 
           c.customer_fname,
           c.customer_lname
         FROM v_synonym_name c;
    BEGIN
    -- GET DB_ID BASED ON INPUT PARAMETERS       
      select d.db_id
      into v_db_id
      from  t_mv_db_accounts ac,
      t_mv_db_instances i,
       t_mv_dbs d,
       t_mv_hosts h
      where ac.db_ID = d.db_ID
      and i.db_ID = d.db_ID
      and i.HOST_ID = h.host_id
      and upper(H.HOST_NAME) = v_hostname
      and upper(D.DB_NAME) = v_instance
      and upper(Ac.ACCOUNT_NAME) = v_schema;
      --APPEND DB_ID TO THE SYNOYNM NAME
      v_synonym := 'CUSTOMER_'||v_db_id;
      FOR cust_rec IN insert_customer
      LOOP
         INSERT INTO CUSTOMER_RESULTS (First_Name, Last_Name)
         VALUES (cust_rec.customer_fname, cust_rec.customer_lname);
      END LOOP;
      COMMIT;
    END;
    Rgs,
    Rob

    Hi
    rules engine style with table that holds the logic or code SQL directly in the procedure and IF THEN ELSE with db_id. Latter is better because SQL is native and objects are checked every time procedure is compiled.
    James showed the simplest way but this rather complex way gives you more flexibility between instances if ever needed.
    CREATE TABLE synonym_dml(db_id number not null primary key, sql_text clob)
    INSERT INTO synonym_dml VALUES (100, 'INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer100')
    INSERT INTO synonym_dml VALUES (200, 'INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer200')
    set serveroutput on size unlimited
    create or replace
    PROCEDURE Execute_Synonym_Dml(p_host VARCHAR2, p_db_name VARCHAR2, p_schema VARCHAR) IS
    BEGIN
      FOR r IN (
        SELECT sql_text FROM synonym_dml
        --  WHERE db_id IN (
        --    SELECT d.db_id
        --    FROM t_mv_db_accounts ac, t_mv_db_instances i, t_mv_dbs d, t_mv_hosts h
        --    WHERE ac.db_id = d.db_id
        --      AND i.db_id = d.db_id
        --      AND i.host_id = h.host_id
        --      AND upper(h.host_name)      = p_hostname
        --      AND upper(d.db_name)        = p_instance
        --      AND upper(ac.account_name)  = p_schema
      LOOP
        DBMS_OUTPUT.PUT_LINE('-- executing immediately ' || r.sql_text);
        --EXECUTE IMMEDIATE r.sql_text;
      END LOOP;
    END;
    create or replace
    PROCEDURE Execute_Synonym_Dml_Too(p_host VARCHAR2, p_db_name VARCHAR2, p_schema VARCHAR) IS
      PROCEDURE DB_ID_100 IS
      BEGIN
        DBMS_OUTPUT.PUT_LINE('-- executing DB_ID_100');
        --INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer100;
      END;
      PROCEDURE DB_ID_200 IS
      BEGIN
        DBMS_OUTPUT.PUT_LINE('-- executing DB_ID_200');
        --INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer200;
      END;
    BEGIN
      FOR r IN (
        SELECT 100 db_id FROM dual
        --  SELECT d.db_id
        --  FROM t_mv_db_accounts ac, t_mv_db_instances i, t_mv_dbs d, t_mv_hosts h
        --  WHERE ac.db_id = d.db_id
        --    AND i.db_id = d.db_id
        --    AND i.host_id = h.host_id
        --    AND upper(h.host_name)      = p_hostname
        --    AND upper(d.db_name)        = p_instance
        --    AND upper(ac.account_name)  = p_schema
      LOOP
        IF (r.db_id = 100) THEN
          DB_ID_100;
        ELSIF (r.db_id = 200) THEN
          DB_ID_200;
        ELSE
          RAISE_APPLICATION_ERROR(-20001, 'Unknown DB_ID ' || r.db_id);
        END IF;
      END LOOP;
    END;
    EXECUTE Execute_Synonym_Dml('demo','demo','demo');
    EXECUTE Execute_Synonym_Dml_Too('demo','demo','demo');
    DROP TABLE synonym_dml PURGE
    DROP PROCEDURE Execute_Synonym_Dml
    table SYNONYM_DML created.
    1 rows inserted.
    1 rows inserted.
    PROCEDURE EXECUTE_SYNONYM_DML compiled
    PROCEDURE EXECUTE_SYNONYM_DML_TOO compiled
    anonymous block completed
    -- executing immediately INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer100
    -- executing immediately INSERT INTO customer_results (first_name, last_name) SELECT customer_fname,customer_lname FROM customer200
    anonymous block completed
    -- executing DB_ID_100
    table SYNONYM_DML dropped.
    procedure EXECUTE_SYNONYM_DML dropped.

  • Can a PL/SQL table Object Type be used in a VO?

    Hi,
    Is it possible to use a PL/SQL table object type to provide data to a View Object? In short, I would like to be able to do something like this:
    1. Create record object:
    CREATE OR REPLACE TYPE xx_rec_type AS OBJECT
    (xxid NUMBER,
    xxdesc varchar2(10),
    xxcost number...);
    2. Create table object:
    CREATE OR REPLACE TYPE xx_tbl_type AS TABLE OF xx_rec_type;
    3. Declare and populate the object in PL/SQL package:
    xx_tbl xx_tbl_type;
    xx_tbl(i).xxid := 1;
    xx_tbl(i).xxdesc := 'XXX';
    xx_tbl(i).xxcost := 10.00;
    4. Create a View Object as:
    SELECT * FROM xx_tbl
    Is it even possible to access xx_tbl from View Object? If anyone has done something like this, please do share.
    TIA
    Alka

    A PL/SQL procedure can exist in Oracle DB, in TimesTen, or in both. You control that by where you create the procedure. Procedures that exist in Oracle can really only be called in Oracle and can only access data in Oracle. Procedures that exist in TimesTen can only be called in TimesTen and can only access data in TimesTen. There is a limited capability, using the TimesTen PassThrough capability to call PL/SQL procedures located in Oracle, from Timesten, and for Timesten PL/SQL procedures to access data in Oracle. Using PassThrough does have some overhead.
    Chris

  • To retrieve physical tables used in SP

    Hi all,
    Can anyone help me to get result for Retrieving list of physical tables used in Stored Procedure.
    Thanks in advance.
    Regards, Muthukumar Balu

    You need to run via loop to traverse all physical tables and issue
    SELECT * FROM sys.sql_modules
    WHERE definition LIKE '%'+@table_name+'%'
    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

Maybe you are looking for

  • How to move iphoto library from one account to another?

    For one reason to another I'm making myself a new account on my mac. I'd like to move my iphoto library from the old account to the new one. I was wondering if the instructions about moving the library to a new location (http://docs.info.apple.com/ar

  • Slow gf4 Ti4200

    I'm having a problem with my gf4 Ti4200. It runs at slow framerates even at lower resolution and graphics during games. Ive tested with Nightfire and UT2003 and my friends PC with gf2 runs better. Its in 4x mode and ive been told about dma. whats dma

  • BSP and DMS (Document Management)

    I have to develop a BSP application which provides Documents links from DMS. Is anybody know which BAPI i can use to optain relation between the material (MATERIAL_GETLIST) and the document number DOKNR ? Is somewhere on a blog something was publishe

  • Multiple data sources in endeca

    Hi, I have multiple data sources in endeca like web crawler, xml,database, txt or pdf etc. Can all be configured through dev studio or all through cas or some from cas and some from dev studio? Pls let me know..Thanks!

  • Enabling on-line help for an individual portlet

    Hi, Does anyone know how to enable help for a portlet? There is a parameter that is part of the wwui_api_portlet.draw_portlet_header that specifies has_help, but how does that get set if you use the dynamic page wizard to create the portlet? If you e