How to execute dynamically generated using GR 11, 2 SQL statements?

Hello

I would like to know if it is possible to do what the following statement which is intended :
select * from (select replace('select empno from emp',
                             '',
                             '') from dual);
in other words, is it possible to dynamically generate and execute a select statement in a from clause?

Thank you for your help,

John

Published by: 440bx 16 July 2010 15:57 modified 'create' to 'generate' to the subject

Like many I know no. in SQL. Results of your query in the FROM clause will not be transformed as another query, but just a litral value and your outer query returns this value as "select empno from emp".

But you can use dynamic sql statements in PL/SQL using EXECUTE IMMEDIATE or DBMS_SQL.

Something like that.

DECLARE
 dynamic_from_clause VARCHAR2(4000) := 'select empno from emp';
 vReturnVal NUMBER;
BEGIN
  EXECUTE IMMEDIATE 'SELECT * FROM ('||dynamic_from_clause||')' into vReturnVal ;
END;
/

Just write memory have not tested it.

Tags: Database

Similar Questions

  • How to execute a stored procedure on Sybase with SQL Developer

    We have accessed Sybase 15 with SQL developer.

    We can see the data in the table, if we do not, run the stored procedure (for instance sp_who) developed on Sybase.

    Could you tell me how we execute the stored procedure on Sybase with SQL Developer Sybase?

    Thank you

    Shige

    We will not intended to be a Sybase ASE customer.

    But

    A SQL Developer... @dermotoneill: Workheet advice

  • How to clean the screen using the command in sql developer?

    It seems that the CLS, clean screen or own host both do not work.
    then how?
    Thank you

    Published by: Lyu KingT on April 28, 2010 11:07

    Select "Rambeau" of double;
    Claire;
    Select "deleted raghu" double;

    It clarifies the hope!

    -Rambeau

  • can I use commit between pl sql statements

    Hello

    I wrote unit program, what I used to insert statements and after that I used the command commit.

    But at runtime, it is impossible to insert oracle error. because I used items non-database and database elements
    to make it the next mistake.

    But my question is, can I use commit after the execution of statements in proceedings of program unit.


    Thanks in advance.

    Hello!
    Try calling

    forms_ddl ( 'COMMIT' );
    

    After your DML statements.
    Concerning

  • How to set dynamic IN clause in English query

    Hi ADFExperts,

    I have a requirement as if I had a viewObject

    Let's say that "select * contact"this query result is 20 lakhs records.

    My requirement,

    I have to apply the clause 'IN' in this display object so that it will bring only required line.

    For example Select * from contact where name: bindName;

    I'm passing in the param type string "(" James","John") bindName '"

    and I will execute VO.

    But it is not the result.

    Help, please.

    User, please tell us your jdev version!

    Check out Jobinesh blog decompilation binary ADF: using bind variable for SQL statements with the paragraph which you shoes how to proceed.

    Timo

  • How to call SQL statements in InDesign CS6?

    Hello

    My plugin needs to interact with the database and update the database of content, how do I do it, I can call the SQL statements in InDesign CS6?

    Thanku very much.

    The same way you would call them from any C++ program. You don't mention what platform, and that probably made a difference.

    I am accessing a SQL database in InDesign CS6 on Windows. I use the interface ODBC for SQL Windows database provides, through the nanodbc wrapper. I am therefore a link to odbc32.lib odbccp32.lib and including the nanodbc.cpp and nanodbc.h files. (See http://lexicalunit.github.io/nanodbc/ )

    Paul.

  • How to dynamically generate columns in conventional reports

    Hi all

    How to create dynamic columns in classic reports.

    I need to create these columns that depends on the difference of the date column start date and end date.

    for example: 4 November 2015 start_date and end_date is November 7, 2015

    I show the columns Day1, day 2, day 3 and day 4.

    and the values of these columns are checkboxes.

    Kind regards

    Arianne.

    Hi ujwala1234,

    ujwala1234 wrote:

    How to create dynamic columns in classic reports.

    I need to create these columns that depends on the difference of the date column start date and end date.

    for example: 4 November 2015 start_date and end_date is November 7, 2015

    I show the columns Day1, day 2, day 3 and day 4.

    and the values of these columns are checkboxes.

    The old packed timesheet application has the tip for how to display the day of the week selected by the user in the form of columns in the tabular presentation.

    Reference: old packages of timesheet Application

    That's how I'd do:

    • Select the range of dates populate the days between the date columns range in a collection of the APEX.
    • Display the columns as editable using the APEX_ITEM API.

    NOTE: Application of time sheets there was select list for weeks, so always the number of dynamic columns would be 7 + column code time.

    Also, the maximum number of modifiable columns, you can use on your page APEX is 50.

    Kind regards

    Kiran

  • How to dynamically generate where clause in Linq

    Hi all


    Oracle DB: 11 gR 2
    Oracle Client: 11.2.0.3.0 (ODP.NET)
    Oracle Developer Tools for Visual Studio
    VS 2010 (C#)

    In a Windows Form, it must query the data based on the values in list dropdown listboxes, which the user selects.
    Let's say two combox, one Department and one for salary
    Department:
    -1 all the
    10 Department 1
    20 Department 2
    30 Department 3

    Salary:
    -1 all the
    1 < 20000
    2 20000 to 50000
    3 50000 to 100000
    4 > 100000


    Here is the c# code to query data:
    using (var myEDMctx = new HREntities())
    {
    var LINQrslt = from emp in myEDMctx.EMPLOYEES
    Select emp;

    }


    The default values for the two combox should be everything.
    How to write dynamic where clause for this LINQ?

    Thanks in advance!

    That's what I do.

    var query = from c in customers
    Select c;

    If (where1 > - 1).
    Query = query. Where(c.Where1 > where1);

    If (where2 > - 1).
    Query = query. Where(c.where2 == where2);

    to return the query;

    Published by: Invincible on July 4, 2012 09:25

    Published by: Invincible on July 4, 2012 09:27

  • How can I dynamically load swc files using as3? (without relying on the Flash IDE).

    How can I dynamically load swc files using as3? (without relying on the Flash IDE).

    The SWF file can be used in the same way as the CFC, which means that you don't need to "visually show" anything when it is loaded. Your code can use the classes and assets incorporated into the SWF, just as a SWC file. So if someone just to load the SWF file to see what was in it that they see nothing. They could however access programmatically to what anyone on the inside just like you, if they went to that level. But it is not as easy as just racing as SWF to see what is inside.

    I hope that all packaging several separate sovereigns will allow you to load and unload only what you need to keep the RAM usage as low as possible with a minimum load SWF.

    If you are ready, please mark all useful/correct so we can filter without response. You're welcome and good luck!

  • How to create a dynamic newsflash using dreamweaver and PHP

    Hello

    I would like to create a dynamic newsflash using dreamweaver and PHP because newsflash will be snapped up information from a MySQL database. The Bulletin-Flash should also have a link to view more information about the piece of news a user wants to learn more. What tools do I need to use in dreamweaver and how is the procedure to go about it. All opinions are appreciated. Thanks in advance!

    Sermon of Ras wrote:

    I tried using the spry effects, but it does not work. Is there a best way to do this?

    Google "jquery vertical newsticker" ;-)

  • How to dynamically generate text or all component areas?

    Hello

    I use Flex4 SDK and Flash Builder with eclipse plugin(trail version) for the development of a flex project.

    I have problems to dynamically generate text boxes.

    When I click on a link button, I want a text box to display on the screen. I tried a few examples that I found on the internet but without success.

    I appreciate your time.

    Thank you

    Ravi

    What error do you get?  Maybe try addElement instead of addChild

  • How to assign dynamic identifiers generated manually to the components of the adf

    Hello
    I have a table view, I'm put checkbox into one column.
    I want to assign dynamic ID, for example Chk1, chk2 and so on. limit is the number of rows in a table.

    I tried to use the function of managedbean but doesnot worked.
    code snippet:

    < af:table value = "#{bindings.issueList.collectionModel}" var = 'row' "
    lines = '2' first = '0 '.
    emptyText = "#{bindings.issueList.viewable?" ' {'No records to display.': 'Access Denied.'} ".
    fetchSize = "100".
    selectedRowKeys = "#{bindings.issueList.collectionModel.selectedRow} '"
    rowSelection = "single" id = "table1";
    inlineStyle = ' height: 518px;
    queryListener = "#{bindings.issueListQuery.processQuery} '"
    selectionListener = "#{IssueActionBean.issueTableSelectionListener} '"
    displayRow = 'first' width = '100% ' columnStretching 'last' = >

    < af:column sortProperty = "Select" sortable = "false".
    headerText = "#{res ['Cnm.select ']}" >

    «"< af:selectBooleanCheckbox text ="»
    ID = "Chk" *(dynamically generated numeric value) *.
    "autoSubmit label =" #{row.issueId} "="true"disabled =" #{row.issueId == 0} ' valueChangeListener = "#{IssueActionBean.issueSelectValueChange} '"
    Binding = "#{IssueActionBean.chkIssuesDelete}" / >
    < / af:column >

    I have the above code snippet, I want to have the dynamic id for the checkbox component.

    suggestions welcome.

    Hello

    ID of component cannot be defined dynamically, it is not supported.
    You can pass by [this post | http://forums.oracle.com/forums/thread.jspa?messageID=3746158] for more details.

    Jean Lou

  • MovieClips dynamically generated

    Hello

    I tried to dynamically generate some movieclips the method I've used does the following:

    use a loop to run according to movieclips how I want generated

    whenever the loop cycles it creates a new instance of movieclip

    Adds the new movieclip in a table

    use the addChild method to put the moveclip onstage

    draw a rectangle

    starts filling

    filling of the ends

    It adds to this movieclip

    I then use a conditional statement checking if the movieclip is the first element of the array

    If so it sets the current x MovieClips and there position to a selected value. the first movieclip is used for a starting point to align the rest of the movieclips generated.

    If not the clips x and y position are defined on the elements of the array x and position previos y current movieclips width or height + the gap I wish they have.

    then the cycle repeats

    Ive coded it using code from script and it works very well the forms appear on the stage without errors

    I tried to move this code off the coast of the chronology for a file and the code has no errors, but when it is running I don't see objects even if I followed it y x and y positions I don't see them on the stage

    Script code

    var mcArray:Array = new Array(); / / DEFINE ARRAY FIRST

    var randomNo:Number;

    var colorStr:String;

    var currentColor;

    var movieClip:MovieClip; / / TEMPORARY VARIABLE

    var prevMCx:Number = 0;

    var prevMCy:Number;

    function myFunc (): void

    {

    for (var i: int = 0; i < 200; i ++)

    {/ / FOR LOOP}

    movieClip = new MovieClip();

    addChild (movieClip);

    mcArray [i] = movieClip; / / This is where we add the movieClip references in the table for later use

              if(i == 0)

              {

    mcArray [i] .x = 0;

    mcArray [i] there = 0;

              }

              else

              {

    prevMCx = mcArray [i-1] .x;

    prevMCy = mcArray [i-1] there;

    mcArray [i] .x = prevMCx + Math.ceil (Math.random () * 100);

    mcArray [i] there = prevMCy + Math.ceil (Math.random () * 100);

              }

    randColor();

    mcArray [i].graphics.beginFill (currentColor, 1);

    mcArray [i].graphics.drawRect (0,0,100,100);

    mcArray [i].graphics.endFill ();

    mcArray [i] .alpha = Math.Random ();

    colorStr = null;

         }

    }

    External AS

    package com.mvc

    {

    import flash.display.MovieClip;

    import flash.display.Sprite;

    import flash.geom. *;

    import flash.events.Event;

    import flash.net.URLLoader;

    import flash.net.URLRequest;

    import com.greensock.TweenLite;

    import com.greensock.TimelineLite;

    /public class LibraryLayout extends MovieClip

         {

    public var boxHeight:Number; box height assigned to the main timeline

    public var boxWidth:Number; width of //box assigned to the main timeline

    public var objFill:String; / / fill color box ASSIGN in MAIN TIMELINE

    public var objStroke:String; / / ASSIGN stroke color box in MAIN TIMELINE

    public var layoutTotalItems:uint;

    private var _imgBoxes:Array = new Array ;// holds all the video clips generated loop.

    private var _tempMovieClip:MovieClip; / / the temporary Variable holds current loop [i] movieclip.

    public void LibraryLayout()

              {

    drawBoxes();

              }

    public function drawBoxes (): void

              {

    for (var i: uint = 0; i < 10; i ++)

                   {

    _tempMovieClip = new MovieClip (); Creates a temporary MovieClip

    addChild (_tempMovieClip); / / Adds temporary MovieClip to the stage

    _imgBoxes [i] = _tempMovieClip; / / temporary adds

    _imgBoxes [i].graphics.beginFill (0 x 000000, 1);

    _imgBoxes [i].graphics.drawRect (0,0,100,100);

    _imgBoxes [i].graphics.endFill ();

    //===trace statements, check if the feature does not.

                        If (i == 0)

                        {

    _imgBoxes [i] .x = 10;

    trace (_imgBoxes [i] .x);

                        }

                        else

                        {

    _imgBoxes [i] .x = _imgBoxes [(i-1)] .x + (_imgBoxes [i] .width + 10);

    trace (_imgBoxes [i] .x);

                        }

    _imgBoxes [i] there = 150;

                   }

              }

    public function tweeningSlides (): void

              {

              }

         }

    }

    I am very confused why it does not work if you need more details let me know

    If anyone can help me solve this problem, it would make my month!

    Right. I don't see where you

    addChild (libraryLayout)

    The LibraryLayout class extends MovieClip and if MovieClips are visible they need to be added to the display list.

    Only the document class is added automatically, but her children aren't.

  • Dynamically generated movieclip properties

    Hello

    I'm reading in the data to an XML file. Each attribute of a child is assigned as a property of a movieclip as shown in the related code. However, I want to do is don't have not not the property will have already decided names that I don't necessarily know how to attribute a child in the xml file. Is it possible to dynamically name properties according to what number attribute, they are...?

    Thanks in advance

    Greg

    Yes it's possible... :)

    the docs have an example related directly to it, using the method "attributes()" (with the ') you can return a list of all the attributes of a node object to give in the form of an XMLList object. then iterate through this object, you can use the 'name()' method to return the name of each attribute. as you do this, you can use operators to access to dynamically generate the properties of the object of MC, and then assign the values in the other table, as in:

  • Dynamically generate UPDATE instructions

    DB version: 10 gr 2

    I was give a list of
    OLD_VALUE         NEW_VALUE
    ---------         -----------
    HR                 PERSONNEL
    FINANCE            FINC
    FACILITIES         FACS
    .
    .
    .
    I need to find all the columns that begin with DEP % table with a string 'HR' and updated 'STAFF' and the rest of the old to the new values as noted above. I'm trying so generate UPDATE instructions for this

    Answer to my question was actually provided by bluefrog to
    Re: Problem with SQL to write SQL help

    Thanks bluefrog.
    select
    ' update ' ||table_name ||' set '||column_name||' =replace('||column_name ||','||'''HR'''||','||'''PERSONNEL'''||');' 
    from user_tab_columns 
    where and column_name like 'DEPT%'
    But my old_Value, new_value list has 70 entries. So, I need to manually execute the above statement 70 times!
    How can I make the OLD_VALUE, NEW_vALUES to this sql and generate instructions to UPDATE, I need?

    Load the OLD_VALUE / new_value by list in the database using SQLLDR, external Tables, or by hand.

    Then browse these values generating the SQL you need.

    Maybe something like that? (Note this is not tested, just threw together quick):

    BEGIN
            FOR r IN
            (
                    SELECT  old_value
                    ,       new_value
                    FROM    update_list
            )
            LOOP
                    FOR s IN
                    (
                            SELECT  table_name
                            ,       column_name
                            FROM    user_tab_columns
                            WHERE   column_name LIKE 'DEPT%'
                    )
                    LOOP
                            DBMS_OUTPUT.PUT_LINE('update ' ||s.table_name ||' set '||s.column_name||' =replace('||s.column_name ||','''||r.old_value||''','''||r.new_value||''');'
                    END LOOP;
            END LOOP;
    END;
    

    Published by: Centinul on June 3, 2010 12:52

Maybe you are looking for

  • NB100 - can't see the SD card in the BIOS

    Anyone know why I can't see my 16 GB SD card in the bios?It loads up as sdb1 when the computer is started, if it is recognized as a hard drive.

  • How to recover the laptop?

    Hi guys,. OK, so I have a really bad virus on my computer, is not picking up my Norton software. Someone told me I have to restart my computer to get rid of the virus, but my files will be lost.I think that the process is called resumption because it

  • TWIN MEMORY? Z575

    Hello I have a laptop Lenovo IdeaPad Z575GM cu processor AMD A6 - 3400M 1.40 GHz, 4 GB, 500 GB, AMD Radeon HD 6520 I want to 'give' another 4 GB. Will it work in DUAL CHANNEL? My index of 7 (x 64) windows current 5.9 (out of memory), I read that she

  • Sub - VI implicit calendar within a LabVIEW FPGA SCTL

    I have a question about the time of a Subvi in one SCTL when LabVIEW is translated into VHDL. Did the translate Flatten all code within the SCTL effectively remove the Subvi borders, or a Subvi act like a framework unique sequence around this code. F

  • Performance index Windows of your system could not be calculated

    Hi guys,. I use a desktop with win-7(32bit) SP1. When I have one tries to use the option my computer, I get an error. I use Mcafee antivirus but I also tried to uninstall the antivirus but the same problem occurred. I tried to read its log (C:\Window