Possible to construct SQL in PL/SQL from data?

If I have a table which holds 2 columns, tablename and keylist, can I effectively construct common SQL using these values?
EG
Loop on ever row in MY_TABLE_LIST
v_table=loop.TABLE_NAME
v_keyley=loop.KEYLIST
select * from v_table
and
select t.v_keylist, sysdate from v_table t
Ie that kinda thing?

You can it.
One of example is that plsql generates plsql block dinamicaly and execute immediate it.
But what is your exact requirement ?
select * from v_table
Is here number,datatype and order of columns all same?
If that was not, how do you think handle output (interface etc.)?

Similar Messages

  • Cannot Open SQL from Data Prep Editor (SQL Interface)

    Hi,
    When I Open SQL in Data Prep Editor: "There are no data sources defined. Please create one to continue."
    I create a ODBC connections using the drivers bellow and I obtain always the same message ("There are no data sources defined.."):
    Oracle in OraDb10g_home2
    Microsoft ODBC for Oracle
    MERANT OEM 5.2 32-BIT Oracle
    I have installed and configured Essbase, release 11.1.1.2
    Is posible that the SQL interface is not installed and configured with the Essbase Server?
    How I can install and configure the SQL Interface? I need to do somethink else?
    Thanks!
    Assia

    Through EAS select the server and right click and select properties. then go to the environment tab(I think) it should show everything you are licensed for. If this is a System 9 or higher, you should have it automatically. If it is 7X or below,then yoes it has to be licensed

  • Access SQL Server data at time of Windows OS Boot Process

    It is possible to access SQL Server data at time of Windows OS Boot Process and before login into Windows.
    if anybody any idea on this.
    If you think my suggestion is useful, please rate it as helpful.
    If it has helped you to resolve the problem, please Mark it as Answer.
    Varinder Sandhu www.varindersandhu.in

    No, you need to identified before accessing to SQL Server. It is like you try turn on electric cooker before you open the door.
    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

  • Timezone problem in XML from data template

    The xml returned from one of my data templates seems to be randomly applying timezones of +00:00 or +01:00 to the dates.
    This is causing a problem in the PDF output from the report where the timezone is processed and some of the dates are showing as the day before that held in the database. The sql in the data template is just returning the raw column, no extra processing there. What's going on, is this a known bug?
    Appreciate any help you can provide.
    Cheers,
    Dave
    XML extract:
    - <G_TRX>
    <EXPENSE_TEMPLATE>N/AMiscellaneous Expenses</EXPENSE_TEMPLATE>
    <TEMPLATE_DATE_CREATED>2007-09-13T11:51:46.000+01:00</TEMPLATE_DATE_CREATED>
    <TEMPLATE_DATE_INACTIVATED>2008-06-05T00:00:00.000+01:00</TEMPLATE_DATE_INACTIVATED>
    <EXPENSE_ITEM>Evening Dress Hire</EXPENSE_ITEM>
    <ITEM_DATE_CREATED>2007-09-13T12:24:54.000+01:00</ITEM_DATE_CREATED>
    <ITEM_DATE_INACTIVATED />
    <TAX_CATEGORY>PAY</TAX_CATEGORY>
    <ASSIGNMENT_DATE>2007-09-28T00:00:00.000+01:00</ASSIGNMENT_DATE>
    <TAXCAT_DATE_INACTIVATED>2007-11-07T00:00:00.000+00:00</TAXCAT_DATE_INACTIVATED>
    </G_TRX>
    - <G_TRX>
    <EXPENSE_TEMPLATE>N/AMiscellaneous Expenses</EXPENSE_TEMPLATE>
    <TEMPLATE_DATE_CREATED>2007-09-13T11:51:46.000+01:00</TEMPLATE_DATE_CREATED>
    <TEMPLATE_DATE_INACTIVATED>2008-06-05T00:00:00.000+01:00</TEMPLATE_DATE_INACTIVATED>
    <EXPENSE_ITEM>Evening Dress Hire</EXPENSE_ITEM>
    <ITEM_DATE_CREATED>2007-09-13T12:24:54.000+01:00</ITEM_DATE_CREATED>
    <ITEM_DATE_INACTIVATED />
    <TAX_CATEGORY>P11D</TAX_CATEGORY>
    <ASSIGNMENT_DATE>2007-11-08T00:00:00.000+00:00</ASSIGNMENT_DATE>
    <TAXCAT_DATE_INACTIVATED>4712-12-31T00:00:00.000+00:00</TAXCAT_DATE_INACTIVATED>
    </G_TRX>
    - <G_TRX>
    <EXPENSE_TEMPLATE>N/AMiscellaneous Expenses</EXPENSE_TEMPLATE>
    <TEMPLATE_DATE_CREATED>2007-09-13T11:51:46.000+01:00</TEMPLATE_DATE_CREATED>
    <TEMPLATE_DATE_INACTIVATED>2008-06-05T00:00:00.000+01:00</TEMPLATE_DATE_INACTIVATED>
    <EXPENSE_ITEM>Evening Dress Purchase</EXPENSE_ITEM>
    <ITEM_DATE_CREATED>2007-09-13T12:24:54.000+01:00</ITEM_DATE_CREATED>
    <ITEM_DATE_INACTIVATED />
    <TAX_CATEGORY>PAY</TAX_CATEGORY>
    <ASSIGNMENT_DATE>2007-01-01T00:00:00.000+00:00</ASSIGNMENT_DATE>
    <TAXCAT_DATE_INACTIVATED>4712-12-31T00:00:00.000+00:00</TAXCAT_DATE_INACTIVATED>
    </G_TRX>
    SQL from data template:
    - <sqlStatement name="Q_TRX">
    - <![CDATA[
    select aer.REPORT_TYPE "EXPENSE_TEMPLATE"
    ,aer.CREATION_DATE "TEMPLATE_DATE_CREATED"
    ,aer.INACTIVE_DATE "TEMPLATE_DATE_INACTIVATED" 
    ,aerp.PROMPT "EXPENSE_ITEM"
    ,aerp.CREATION_DATE "ITEM_DATE_CREATED"
    ,aerp.END_DATE "ITEM_DATE_INACTIVATED"
    ,xaetl.TAX_CATEGORY "TAX_CATEGORY"
    ,xaetl.EFFECTIVE_START_DATE "ASSIGNMENT_DATE"
    ,xaetl.EFFECTIVE_END_DATE "TAXCAT_DATE_INACTIVATED"
    from ap_expense_reports aer
    ,ap_expense_report_params aerp
    ,xx_ap_expense_tax_lines_f xaetl
    where aer.EXPENSE_REPORT_ID = aerp.EXPENSE_REPORT_ID
    and aerp.PARAMETER_ID = xaetl.expense_report_parameter_id
    AND &p_exp_item_lines_where
    AND &p_tax_category_where
    AND &p_exp_template_where
    ORDER BY aer.REPORT_TYPE
    ,aerp.PROMPT
    ,xaetl.EFFECTIVE_START_DATE
      ]]>
    </sqlStatement>

    Tim
    Is is a sample record from the sql query. Sorry it's not the same as the XML above but the data has changed on the instance so some of the fields weren't populated on those records.
    EXPENSE_TEMPLATE,TEMPLATE_DATE_CREATED,TEMPLATE_DATE_INACTIVATED,EXPENSE_ITEM,ITEM_DATE_CREATED,ITEM_DATE_INACTIVATED,TAX_CATEGORY,ASSIGNMENT_DATE,TAXCAT_DATE_INACTIVATED
    "Long Term Detached Duty",12/09/2007 14:45:57,null,"LTDD:Air Travel
    Domestic",13/09/2007 11:45:08,null,"PSA",01/01/2007,31/12/4712
    First row is column names for ease of understanding :-)
    Appreciate any info you can provide on this.
    Cheers,
    Dave

  • Is it possible to load a dump file collected from sql server to orcle 10gR2

    Hi..
    As a part of data migration from legacy systems , we need to migrate only required tables from Sql server to Oracle 10gr2 .
    At present client is telling that he will give it as dump file.
    My question is , Is it possible to load the dump file collected from sql server to oracle 10gR2?
    Thanks in advance ..

    yes, it is.
    Using for example SQL Developer Migration Workbench even allows you to create unload scripts for the desired SQL Server tables and it also creates the DDL scripts for you to create the Oracle tables similar to the SQL Server table AND it alows creates the SQL*Loader scripts that allow you to load the SQL Server generated dump file into the Oracle db.
    Here the link:
    http://www.oracle.com/technology/tech/migration/workbench/index_sqldev_omwb.html
    If you do not want to use this utility, you can also use SQL*Loader to load the content of the SQL Server dump file into the Oracle database; but in this case you have to write the whole SQL*Loader control scripts on your own.
    Edited by: kgronau on Sep 16, 2009 1:54 PM

  • Is it possible to call a windows batch file from PL/SQL

    Hi gurus,
    Would require your help.Is it possible to call a windows batch file from PL/SQL??If yes can you give an example for the same or any workaround for the same.
    Regards
    Vijay

    Hi!
    Youn need some extproc related entries in you listener.ora and tnsnames.ora file.
    *1. In the listener.ora:*
    Defining the listener process is done in two parts.
    The information contained in each listener differs!!!
    The first part is as follows:
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = extproc))  <---  *ADD THIS LINE
          (ADDRESS = (PROTOCOL = TCP)(HOST = yourhostname)(PORT = 1521))
      )The seoncd part is as follows:
    SID_LIST_LISTENER =
      (SID_LIST = 
        (SID_DESC =
          (GLOBAL_DBNAME = YOUR_GLOBAL_DBNAME)
          (ORACLE_HOME = c:\oracle\product\10.2.0)  <-- THIS IS YOUR ORACLE_HOME
          (SID_NAME = YOUR_SID)                            <-- SID
        (SID_DESC =                                              <--- ADD THIS LINE
          (SID_NAME = PLSExtProc)                          <--- ADD THIS LINE
          (ORACLE_HOME = c:\oracle\product\10.2.0) <--- ADD THIS LINE AND EDIT TO YOUR ORACLE_HOME
          (PROGRAM = extproc)                                <--- ADD THIS LINE
          (ENV = "EXTPROC_DLLS=ANY")                  <--- ADD THIS LINE
        )                                                                <--- ADD THIS LINE
      )*2. In the tnsnames.ora you need to add the following entry:*
    *(The KEY value entered must be match to the KEY value entered int the listener.ora file!)*
    EXTPROC_CONNECTION_DATA =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = IPC)(KEY = extproc))
        (CONNECT_DATA =
          (SID = PLSExtProc)
          (PRESENTATION = RO)
      )Finally you need to restart your listiner. After restarting there will be a service called "PLSExtProc" in your listener.
    This are only examples for extproc configuration, your tnsnames.ora and listener.ora can be differs.
    FIRST MAKE MAKE A BACKUP OF YOUR ORIGINAL tnsnames.ora AND listener.ora FILES
    For more information please check metalink note 68061.1 "EXTPROC: Creating External Procedures on Windows NT"
    Bestr Regards
    Norbert

  • Is it possible to call a windows batch file from PL/SQL block ??

    Hi gurus,
    Would require your help.Is it possible to call a windows batch file from PL/SQL block ??If yes can you give an example for the same or any workaround for the same.
    Regards
    Vijay

    You didn't specify a database version, but if you are 10g or higher, it's quite straightforward using an external job type in DBMS_SCHEDULER. Funnily enough i'm looking at something similar myself at the moment.
    Useful guide to some of the issues here Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files

  • Is it possible to move to Alwayson Availability groups from existing sql server FCI ?

    Is it possible to move to Alwayson Availability groups from? existing sql server FCI ?
    If yes, how to move and what are the pre-requisites?

    Hi Rahul,
    Based on your description, we need to verify if you want to move from Failover Cluster Instances(FCI) and database mirroring to SQL Server Alwayson Availability groups. If so, it is possible.
    You can review the following articles to get more detailed information about this kind of migration.
    How To: Migrate from Failover Cluster Instances and Database Mirroring to SQL Server AlwaysOn
    – Part 1
    How To: Migrate from Failover Cluster Instances and Database Mirroring to SQL Server AlwaysOn
    – Part 2
    Thanks,
    Lydia Zhang

  • 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

  • Executing sql from table with in plsql procedure

    I wonder if anyone can help.
    I have a table that stores sql statements. They are actually a set of rules that I want to apply to my application. My intention is to execute the statement in plsql.
    EG a sql statment held in the table might be:
    'select count(id) from item where item_id = ' || constants_pkg.c_test_item || ' and client_id = ' || client_id_in
    I am trying to call this from a plsql procedure, I’ve CUT OUT some of the procedure task_rec.rule holds the statement above. The procedure is failing “invalid SQL statement”, I think the client_id_in may not be evaluating as the variable, passed into the procedure and constants_pkg.c_test_item not being taken from the constants pkg.
    EG.
    PROCEDURE create_additional_info_list(
    client_id_in IN client.id%TYPE,
    IS
    result VARCHAR2(100);
    BEGIN
    EXECUTE IMMEDIATE
    task_rec.rule
    INTO result;
    END;
    If I was to do below the code would work ok. However I require the rule to come from the table.
    EXECUTE IMMEDIATE
    'select count(id) from item where item_id = ' || constants_pkg.c_test_item || ' and client_id = ' || client_id_in
    INTO result;
    Is there anyway constants_pkg.c_test_item and client_id_in can be evaluated as variables?

    Not that I've tried this but, if possible, change the SQL in the table to have bind variable; e.g.,
    'select count(id) from item where item_id = :1 and client_id = :2 ';
    Then in the procedure
    execute immediate task
    INTO result
    USING constants_pkg.c_test_item ,
    client_id_in ;

  • Converting a SQL Command Parameter from Date to Char

    Hi,
    I'm using CR XI version 11.0.0.1282.  I've created a report using a SQL Command and have a parameter defined as Date.  I need to convert this Date parameter to a CHAR and have created my WHERE clause as:
    WHERE  "CC_PAYH"."PPOST"= CHAR ('{?From Date}') AND
    "CC_PAYH"."PPTYPE"<>13
    I get a message saying 2008 is not a valid token which in AS400 means it doesn't like the year.  Go figure. 
    I've tried running a similar query in AS400 and I get the desired affect.  I've tried removing the parameter from the Where clause and putting it into the Select like:
    CHAR ('{?From Date}') as MyTestDate
    just to see the representation I would get and I get the same error. 
    The question I have like everyone else is; is this possible with this version of Crystal?  I assume so since the same query will work in the database itself. 
    Thanks,
    Brian

    Hi Brain,
        Can you please try the query similar to the following syntax and verify whether it helps you!
    Select * from Orders where ([Order Date]) =
    CStr({?Date})
    Regards,
    Vinay

  • Is it possible to see SQL in SQL-T without having to check out the mapping?

    Hello guys, Is it possible to see SQL in SQL-T without having to check in the mapping? At my work they use SQL-T a lot and in SQL query tab they use a lot of SQL so I was wondering if you can see the query without checking out the mapping?  Let me know. Thanks

    Hi All, I am facing an issue wherein Decimal value of 0.01 is getting converted to 0.00. Let me brief you about Source-Target Types Source - Flat FileTarget - DB2Powercenter Version - 9.6.1 HF2 Issue -  Field in Source Flat file is defined as Number(5,2). Corrosponding field from DB2 Target Table is defined as Decimal(5,2). Mapping is simple straight forward mapping with 1:1 loading from Source to Target. Now, my Source File contain data as below0.010.020.0312.01 When I execute mapping DB2 target Table gets loaded with all records. Value from corrosponding field from DB2 target table is - 0.000.020.0312.01 As you can see, value of 0.01 is getting converted to 0.00 where as all other values are working fine as expected. As a quick fix I have applied to_decimal(source_field,2) before loading into Target. Could anyone explain if this is a bug in Powercenter or there's some other issue. If I think its a rounding issue then how come value of 0.02 is getting processed correctly? Please advise. Thanks,Rajesh Agrawal

  • Comments not imported from Data Dictionary of SQL Server. SDDM 3.3.0.747

    Hi,
    SDDM 3.3.0.747 32-bit on Windows 7 64-bit.
    Comments are not imported from Data Dictionary of SQL Server 2008. Connection through Microsoft JDBC Driver 4.0 for SQL Server or jTDS 1.2.7
    What I have tried? In SDDM DDL generation, Comments in DBRMS for SQL Server are generated with "EXEC sp_addextendedproperty 'MS_Description' , 'Test Comment' ..." so I added extended property named "MS_Description" into SQL Server database, both on table and column. None of them were imported from Data Dictionary into SSDM. I have tried both drivers stated above. Is it a bug or am I missing something?
    I've found similar question thread Re: Data dictionary import doesn't import column comments for SDDM 3.0.0.665, so I guess it is a bug when importing with JDBC drivers.
    MiGli
    Edited by: MiGli_1006342 on May 25, 2013 8:32 AM
    Edited by: MiGli_1006342 on May 25, 2013 9:02 AM

    Extended properties were not imported correctly from SQLServer databases at DM 3.3.0.747.
    Calls to sp_addextendedproperty and fn_listextendedproperty have been modified.
    I don't think it is a problem with JDBC drivers.
    A bug fix should be available in the next release of DM.

  • SQL modeler can not import from data dictionary

    It was very frustruted to see that the SQL Modeler hang in import from data dictionary of a database as part of revise engineering. I have to question myself if sql modeler is a serious tool and should I give up.

    I am not sure if Data Modeller is still in Beta./Production. First couple off initial versions of a new product are normally buggy.
    Regards
    Alternatively, If this product is still in Beta, then you can contact the development team or report the issue so that they can take care of this issue in next beta release.
    Edited by: skvaish1 on Mar 30, 2010 3:18 PM
    Edited by: skvaish1 on Mar 30, 2010 3:26 PM

  • Is it possible to install sql server 2008 standard edition in windows server 2008 enterprise edition?

    hi,
    Please help me..
    is it possible to install sql server 2008 standard edition in windows server 2008 enterprise edition?
    will any problem arise?

    Hiya,
    Yes it it possible. No there will not be any problems.
    Short and simple :)

Maybe you are looking for

  • Need A Code For CMD_EI_API

    Hi All, I used the class CMD_EI_API and method MAINTAIN_BAPI in my report to create a customer master data (data uploaded from the excelsheet which is  already has the customer number ) ,its not showing any messages and not even updating the table if

  • Are there any additional templates for pages other than those you get when you install the program? If so, where do you find them?

    I am looking for additional templates for iWork, specifically for pages. Does Apple or anyone else have them?

  • Help for IPOD touch

    My Ipod all the apps on it are really LARGE size now and when I use the reset it doesn't fix the problem also when plugged into my truck it will only play one song over and over it won't let me change it but then the apps are so large that it's hard

  • How to display Error for a particular text box programaticaly

    Hello All, I have 5 text boxes in a form and I have a requirement where if user click on any of the text boxes then i need to pass the id to class A and show the error description related to that text box in faces message. I have created class A in w

  • No-sac error under sacadm status

    Hello all, I am trying to find some info on an error that I am receiving during a modem install on Solaris 8. The error is (zsmon could not be modified). Here is the status of sacadm -1 (pmtag/zsmon, pmtype/ttymon, flgs/-, rcnt/o, status/no-sac, comm