How to execute code saved in string variable??

Hello experts,
I need to execute a select which I obtain concatenating several fields into string variable.
So the select is saved in a string:
var  = 'select... from ... where...'.
There is any way to execute that select? ("exec var." or similar??)
thanks

Hello Illie
Would it not be possible to use a simple dynamic SELECT, e.g.:
DATA:
  ldo_data   TYPE REF TO data.
FIELD-SYMBOLS:
  <lt_itab>  TYPE TABLE.
CREATE DATA ldo_data TYPE TABLE OF (ld_tabname).
ASSIGN ldo_data->* TO <lt_itab>.
SELECT * from (ld_tabname) INTO TABLE <lt_itab>
   WHERE (ld_clause_string).
Regards
  Uwe

Similar Messages

  • How to execute the content of varchar  variable like a simple query

    Hi everyone!
    I did a PL/SQL region in apex, in this region I did the query which is storaged in a variable; it was did it concatenate several times,
    in the procedure I have several sentences.
    I thought that the command 'execute immediate' would get a good result but it do not print the result.
    declare
    variable varchar2(1000);
    begin
    --sentences
    --execute inmmediate( variable );
    --return variable
    end;
    I only want to how to execute the content of varchar variable.
    For example, suppose that the result of this procedure is
    'SELECT SYSDATE FROM DUAL'
    How and what do I must do for this query execute like a normal query that is in apex?
    I expect your prompt reply.
    Thank you for your help.
    Best regards

    Let us say your table containing SQL is
    t_sql_table
    and has two columns
    primary_key
    and
    sql_query.
    You would need to do the following:
    1. Create a Report of type "Function returning SQL Query"
    2. Put the following there:
    DECLARE
       v_query   VARCHAR2 (4000);
    BEGIN
       SELECT sql_query
         INTO v_query
         FROM t_sql_table
        WHERE primary_key = 1;
       RETURN v_query;
    END;Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to execute code from a text file?

    Hello all!
    How to execute some code lines from a text file? For example my file is:
    String varname = "somecontents";
    JFrame frame = new JFrame();
    frame.setVisible(true);How can I get contents of this file and parse them if I want get new JFrame and access to the variable varname?

    I mean the PHP would generate a readable Java source,
    for example some variables with some data, and I just
    dont know what to do with file if I want generate the
    xls file from my saved data, could You help? :)Some variables, some data, PHP, Java, XLS file??? Al rather vague.
    You need to explain in more detail what it is you're trying to do if you want an answer to your question!

  • How to catch exception into a String variable ?

    I have a code
    catch(Exception e)
                e.printStackTrace();
                logger.error("\n Exception in method Process"+e.getMessage());
            }when i open log i find
    Exception in method Process null.
    But i get a long error message in the server console !! I think thats coming from e.printStackTrace().
    can i get the error message from e.printStackTrace() into a String variable ?
    I want the first line of that big stacktrace in a String variable.
    How ?

    A trick is to issue e.printStackTrace() against a memory-based output object.
    void      printStackTrace(PrintStream s)
             // Prints this throwable and its backtrace to the specified print stream.
    void      printStackTrace(PrintWriter s)
    //          Prints this throwable and its backtrace to the specified print writer.Edited by: BIJ001 on Oct 5, 2007 8:54 AM

  • How to compare numbers in a string variable?

    I have a powershell script that is grabbing the output of a website and storing it into a string variable. What I would like to do is check a line in the output which contains two numbers - the number of emails sent out of the total number of emails.
    I have not come up with a way to do this that works. I was thinking of maybe using a regex, but there are other numbers I don't care about that keep getting caught.
    Here is a sample of what is contained in the string variable:
    Email ID: 46862270 : Succeded. Time Taken: 00:00:00.0924511
    Email ID: 46862272 : Succeded. Time Taken: 00:00:00.0493887
    -- Sent 250 of 250 emails successfully. Total Dispatch Time: 00:00:08.1406995
    --State Written to DB. Time Taken for DB Write: 00:00:00.4611053
    Here is another sample:
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 17 of 17 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    So if I have the above contained in a variable called $httpResponse how can I find only the line that starts with -- Sent
    and then subtract the first number from the second number?
    So for example if I have this:
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 207 of 217 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    I would want the check to return 10. Is this even possible?
    Any help is appreciated!

    Sure.
    $String = @'
    Email ID: 46865840 : Succeded. Time Taken: 00:00:00.9333887
    -- Sent 207 of 217 emails successfully. Total Dispatch Time: 00:00:01.2416905
    --State Written to DB. Time Taken for DB Write: 00:00:00.0402957
    if ( $string -match 'Sent (\d+) of (\d+) emails .+' )
    { $FailedEmailCount = [int]$matches[2] - $matches[1] }
    $FailedEmailCount
    10
    Each set of parens will designate a capture group, and those can be referenced from $Matches after a successful -match.
    Just remember that they will all be strings, and to do a math operation you have to cast at least the one on the LH side to a numeric type first.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How to Find Code for SAP Exit variables.....

    Gurus:
    The SAP Business Content Query "0FIAR_C03_Q0005" uses several BC variables of 'SAP Exit' type for determining "Date" values. I would like to see the code used in these variables. Can anyone please suggest how I can find it?
    For examople, the variable on Posting Date is "0P_KEYD2". What is the ABAP code for this? Please give me the Steps..!
    Thanks in Advance......PB

    Generally SAP doesn't give access to the code behind SAP exit variables, but you can find what the variable is doing using help documentation. Here is some info i saw on SAP help for your variable
    0CWD Current workday
    0DAT Current calendar day
    0P_KEYDT Key date of due date
    0P_KEYD2 Key date of posting (from key date of due date)
    0P_KEYD3 Key date of clearing (from key date of due date)
    0P_KEYD4 Key date of posting (posting date)
    0P_KEYD5 Key date of clearing (from key date of posting)

  • Execute code from a string?

    I have a Java program that draws lots of different types of curves.
    I need to program how to save a drawing to a file.
    It would be easiest to make a file that has the string of the code which recreates the drawing.
    Is it possible to execute the content of a string?
    A trivial example would be you declare an integer
    int number
    and you execute the string
    "number = 10"
    so that the value of number becomes 10.
    Is this possible?

    However, how does your program draw the curve in the first place? What I mean is, if it draws the curve in response to some informatiion from the user, why not save that information as text and then draw the curve the same way when the text is read again later.

  • How to execute a method from String object?

    I have some methods in String objects, example:
    String methodOne = "someMethod1";
    String methodTwo = "someMethod2";
    public void someMethod1() {
    public void someMethod2() {
    How can i execute that methods, when the method names i have only in String objects?

    You can get the method directly from the name and parameter types if you want to avoid using the loop:public class Foo27 {
      public static void main (String[] args) throws Exception{
        String methodOne = "someMethod1";
        String methodTwo = "someMethod2";
        Object foo = new Foo27();
        Method method1 = foo.getClass().getMethod(methodOne, new Class[]{});
        method1.invoke(foo, null);
        Method method2 = foo.getClass().getMethod(methodTwo, null);
        method2.invoke(foo, null);
      public void someMethod1() {
        System.out.println("someMethod1");
      public void someMethod2() {
        System.out.println("someMethod2");
    }The parameter types are required as there could be more than one method with the same name.
    For somereason when I tried to create a new Method object and invoke it, an exception was thrownThere isn't a public constructor for Method, so how did you create a new one?
    Pete

  • HOW TO CUSTOM CODE SAVING/DEFAULT FILE ITEM BLOBS IN PORTAL

    I am trying to create a link for Portal users to allow them to upload a
    specific File type in Portal. This is taking advantage of Portal's Content
    Management features (not the same as iFS). I want to know what API's to use
    and the steps to perform to create a process for users to upload a file to
    Portal with default settings such as the filename is the Display Name and the
    image/icon is set accordingly to the extension in the filename. i.e.
    mydocument.doc would display in Portal as mydocument.doc with a Microsoft Word
    image/icon (in Portal /images/word.gif) rendered next to it. This is very
    similar to the List View in a Portal Page. Can a Portal Developer lead me in
    the right direction how to do this. If the PLSQL code wasn't obfuscated, I
    could see how Oracle developed the PORTAL.wwsbr_ui_bulkaction.render_list
    procedure for it's almost exactly what I need to accomplish.

    Recommend you use Firefox and firebug it is best tool ever invented!
    <UCM>\shared\config\templates
    Also document.newcollectionform.submit(); is just a default function.
    Document = Currentpage
    newCollectionForm = Name of form
    submit(); = Default javascript event to submit form.
    Here is the form :
    <form name=newcollectionform method=POST action="/<ucm>/idcplg">
    <input type="hidden" name="IdcService" value="COLLECTION_NEW">
    <input type="hidden" name="hasParentCollectionID" value="true">
    <input type="hidden" name="dParentCollectionID" value="2">
    <input type="hidden" name="dCollectionInherit" value="0">
    <input type="hidden" name="dCreateDate" value="18/05/2005 16:37">
    </form>

  • How to execute code when press the ENTER key

    Hello,
    I've write the code in Key-ENTER trigger, but it doesn't work when I press ENTER key.
    Best Regards
    Joe

    Matth M
    Thank you.
    The following msg. from help system shows that key-enter trigger will execute when the ENTER pressing event occurs. Need your more help.
    Regards
    Joe
    >
    (index: "DO_KEY" )
    Executes the key trigger that corresponds to the specified built-in subprogram. If no such key trigger exists, then the specified subprogram executes. This behavior is analogous to pressing the corresponding function key.
    Built-in............Key Trigger............Associated Function Key
    ENTER............Key-ENTER............[Enter]

  • How to execute code written in java before javascript?

    Hello,
    is there any way to call the action or actionlistener method of a commandbutton (for instance, or any other component), before javascript is executed? (jsf 1.2_09, glassfish v2.1)
    Eg: I want to open a new window with javascript for the details/editing of a row in a data table. To do so I use a request scoped backing bean for the new window, and in its constructor I pass the rowdata through the session map where I put the object beforehand using an actionlistener/action.
    But this won't work, because the script happens before I can put the variable in the session map...
    Is there an other way?
    thanks
    david

    only thing I can come up with is to submit the data using Ajax. So do an Ajax call (for example using JQuery) to submit an asynchronous request to some servlet that will put the data in the session bean, then when the Ajax call finishes open the window.

  • How to execute code after JSF startup?

    Hello,
    I need to execute some initialization code after JSF startup, so I cannot do the usual ServletContextListener trick, as that runs before JSF is completely initialized. Any ideas?
    Kind regards,
    Ulrich

    I can think of one way to do this (which might be a bit cumbersome for what you are trying to do) : use the Spring framework's web integration classes.
    You can specifiy a context listener in your web.xml :
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    That way, Spring will load an ApplicationContext, and in that context you can specify a Spring bean that will be instantiated at application startup, which will perform whatever logic you need to do.
    More info here :
    http://static.springframework.org/spring/docs/2.0.x/reference/webintegration.html

  • How to assign a " into a string variable??

    say, String s="i am a 'cat'", what if i want to replace the ' with " ??
    thanks !

    Use the backslash escape character before the QUOTE.
    String s = "i am a \"cat\"";

  • How to execute the content of varchar as query

    Hi everyone!
    I did a PL/SQL region in apex, in this region I did the query which is storaged in a variable; it was did it concatenate several times,
    in the procedure I have several sentences.
    I thought that the command 'execute immediate' would get a good result but it do not print the result.
    declare
    variable varchar2(1000);
    begin
    --sentences
    --execute inmmediate( variable );
    --return variable
    end;
    I only want to how to execute the content of varchar variable.
    For example, suppose that the result of this procedure is
    'SELECT SYSDATE FROM DUAL'
    How and what do I must do for this query execute like a normal query that is in apex?
    I expect your prompt reply.
    Thank you for your help.
    Best regards

    Erik,
    Try dropping this into a PL/SQL region
    DECLARE
      v_result VARCHAR2(500);
    BEGIN
      SELECT SYSDATE
        INTO v_result
        FROM DUAL;
      htp.prn(v_result);
    END;
    {code}
    use the htp.prn command to write html you want to display. In this case we are just writing the date to the screen.
    Good luck,
    Tyson                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Executing code on EXIT_ON_CLOSE

    I was wondering how you execute code when a JFrame closes using the X button (ie, without using a menu). Because you don't attach an ActionListener to it, I am unsure as to where I would place code that I would like to execute before the program exits.
    Thanks

    add a WindowListener to the JFrame; windowClosing() will be called when the X is clicked (setDefaultAction is more or less just a convenience method for this)

Maybe you are looking for

  • IPhone/MobileMe calendars sync mess

    I have the same calendar that is supposed to sync my two computers and iPhone with MobileMe calendar. What happens is that when I make changes to the calendar on my iPhone it does not affect MobileMe. How do I make iPhone calendar sync with MobileMe?

  • Oracle 8i connectivity with JDK1.4.2 - Failure - Help Needed

    I'm new to Java-ORACLE connectivity. I have installed Oracle 8i v8.1.5 in my Windows 2K Adv. Server with JDK1.4.2. But I could connect to Oracle from Java neither thru JDBC-ODBC nor JDBC thin drivers. What are the files ( or classes ) needed for conn

  • How to get name of PL/SQL stored procedure being executed?

    When executing a PL/SQL stored procedure, is there a way to extract the name of the procedure programatically? (Similar to the way an Oracle Form can retrieve it's own name via GET_APPLICATION_PROPERTY(CURRENT_FORM_NAME). ) Thanks

  • Page not found Error while open install app

    I go through the all necessary steps to configure app domain & steps to create SharePoint hosted app still got 'page not found error' The final app URL that i got afte r open install app -"http://app-125e72eedbe144.domain name:9922/FirstApp/Pages/Def

  • How do I disable auto-hyperlink opening?

    When my cursor passes over a hyperlink, the link opens and I have to close it manually.  I want to only open hyperlinks that I select.  How do I make that happen?