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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

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 organize the content of MANIFEST.MF

    Most of the jar files contain a file named META-INF/MANIFEST.MF, and it provides some information about the class in the jar files, but when I execute the code below, I can't output all of the jar file name in the eclipse project's classpath.
    import java.net.URL;
    import java.util.Enumeration;
    public class TestClassLoader {
    public static void main(String args[]) throws Exception {
    Enumeration<URL> en = TestClassLoader.class.getClassLoader().getResources("META-INF");
    while (en.hasMoreElements()) {
    URL metaInf = en.nextElement();
    System.out.println(metaInf.toExternalForm());
    So I want to know how to organize the content of MANIFEST.MF file to output the file name

    getResources doesn't do what you apparently think it does. The resource path still has to be an exact match, but getResources allows for the possibility that the same resource path may occur multiple times on the class path.
    You could use it to access all the MANFEST.MF files on the classpath but you'd need to full resource path "META-INF/MANIFEST.MF"
    The code you've written doesn't access the contents of the manifests, of course. To access the contents of manifests use java.util.jar.Manifest objects.

  • How to execute the messages in status 'scheduled' automatically?

    Hi.
    I find some messages every day which have status 'scheduled' for a long time - more then several hours. These messages use http adapter. When http server is not working, the messages scheduled, but not executed after http server become working. How to execute the messages automatically?

    http://help.sap.com/saphelp_nw70/helpdata/en/96/8412417301ee6fe10000000a1550b0/content.htm
    Is yours a EOIO scenario?

  • How to read the content in one node of XML in Java? Pls help

    My dear brothers,
    I am a newbie of XML, I have a exercise which is creating a Tree View from XML file. But the trouble is I do not know how to read the content in one node of XML file. I decide to use the algorithm as following:
    1. Create a GUI form which gives the ability for user to choose a XML file (ok)
    2. Load XML and return the file (ok)
    3. Read the file from node to node to create the node in Tree View (?!)
    Please help me, and if you are enough kind, please give me an small example to easy understand. Thanks in advance.
    Hoang Yen Binh

    I hope this one helps you.
         <ABC Type="ProductBased" ProdName="One" Location="India">
              <CEO>Raj</CEO>
              <Finance>Vikram</Finance>
              <HR>Karthik</HR>
              <Technical>Satish</Technical>
         </ABC>
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.NamedNodeMap;
    import org.w3c.dom.Attr;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Node;
    import org.w3c.dom.DOMException;
    import javax.xml.parsers.ParserConfigurationException;
    import org.xml.sax.SAXException;
    import java.io.File;
    import java.io.IOException;
    public class XmlReading {
         Document doc;
         Element element;
         public static void main(String[] args) throws Exception{
              XmlReading xr = new XmlReading();
              xr.getXmlParser(args);
         public void getXmlParser(String[] args) {
              DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                   if(args.length != 1) {
                        System.err.println("Argument Required");
              try {
                   DocumentBuilder builder = factory.newDocumentBuilder();
                   doc = builder.parse(new File(args[0]));
              }catch(ParserConfigurationException e1) {
              }catch(SAXException e2) {
              }catch(IOException e3) {
              getAttributes();
         public void getAttributes() {
              // Retrive the entire Document from the Dom Tree
              element = doc.getDocumentElement();
    //          System.out.println(element);
              NamedNodeMap attrs = element.getAttributes();
              // Get number of attributes in the element
         int numAttrs = attrs.getLength();
         // Process each attribute
              for (int i=0; i<numAttrs; i++) {
                   Node node = attrs.item(i);
                   // Get attribute name and value
                   String attrName = node.getNodeName();
                   String attrValue = node.getNodeValue();
                   System.out.println(attrName + ": " + attrValue);
              String s1 = element.getTagName();
              System.out.println(s1);
              // To get all the elements in a DOM Tree
              NodeList nl1 = element.getElementsByTagName("*");
              int i2 = nl1.getLength();
              System.out.println(i2);
              for(int i=0; i<i2; i++) {
                   System.out.println(nl1.item(i) + "\n");
    }

  • How to read the contents of attached files

    Hi,
    I am designing a Form using LiveCycle Designer 8.0
    Scenario:
    User can attach the file through "Attachments" facility provided on Adobe  Reader.
    The requirement is to attach 3 documents and post it to SAP system using Web services.
    I am using the following code(which i got from this forum only) to find the number of files user has attached.
    d = event.target.dataObjects;
    n =  d.length;
    xfa.host.messageBox("Number  of Attachments: "+n);
    //Displaying  the names of the Attached files
    for( i =  0; i < n; i++ )
    xfa.host.messageBox("Name  of the file: "+d[i].name);
    My problem: is how to read the contents of the attached files so that I post it to SAP using Web services
    Thanks in advance!!
    Taha Ahmed

    In order to read the content of the Redo Log files, you should use Logminer Utility
    Please refer to the documentation for more information:
    [Using LogMiner to Analyze Redo Log Files|http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/logminer.htm#SUTIL019]
    Kamran Agayev A. (10g OCP)
    http://kamranagayev.wordpress.com
    [Step by Step install Oracle on Linux and Automate the installation using Shell Script |http://kamranagayev.wordpress.com/2009/05/01/step-by-step-installing-oracle-database-10g-release-2-on-linux-centos-and-automate-the-installation-using-linux-shell-script/]

  • I am thinking of buying a MacBook Air and am wondering how to get the content of my iPad into iTunes.

    I have iTunes on an old pc and am thinking of buying a MacBook Air. I am wondering how to get the content of my iPad on to the Mac as I know that sync only happens in one direction, from pc to device. I assume therefore that when I attach my pad to the new Mac it will sync to an empty iTunes and I will have lost all the content of my pad. I know I can restore purchases, but what about contacts, calendar, photos and music not purchased from apple. I have a fairly recent backup on a pen drive but it is a usb2 device and is formatted for a pc. Any advice would be appreciated.

    Do I copy my media library or from a backup.  I have a backup on my pc and on an external drive. This drive is usb2 and formatted for windows so I can't connect it to a MacBook Air to make the transfer.  Equally I don't think there is a way to connect the 2 computers via a cable ie usb2 one end and usb3 the other.  Will the computers talk to each other via wifi if I enable home share although I think this is only for music which still leaves contacts, mail etc.
    I am sorry to be such an ignoramus but any further help would be appreciated.

  • Help me...How to read the content if "Transfer-Encoding:chunked" is used?

    I am doing a project for internet control using Java,PHP and MySql.All sites should go through the proxy server only.If the HTTP header contains Content-Length,am getting the content length as below:
    public class HTTPResponseReader extends HTTPMessageReader
        String statusCode;
        public HTTPResponseReader(InputStream istream) throws IOException,                     NoSuchElementException
      BufferedInputStream distream = new BufferedInputStream(istream);
      retrieveHeader(distream);
      StringTokenizer st =  new StringTokenizer(new String(HTTPMessageReader.toArray(header)));
      versionProtocol = st.nextToken();
      statusCode = st.nextToken();
      String s;
      while (st.hasMoreTokens())
            s = st.nextToken();
            if (s.equals("Transfer-Encoding:"))
           transferEncoding = new String(st.nextToken());
         if (s.equals("Content-Length:"))
           contentLength = Integer.parseInt(st.nextToken());
         if (s.equals("Connection:"))
          connection = new String(st.nextToken());
          if (connection.equals("keep-alive")) mustCloseConnection = false;
       retrieveBody(distream);     
    }After getting the Content-Length,i used read method to read the content upto that content length.Then i concatenated the HTTP header and body and the requested site was opened.But some sites dont have Content-Length.Instead of that,Transfer-Encoding is used.I got the HTTP Response header as "Transfer-Encoding:chunked" for some sites.If this encoding is used how to get the length of the message body and how to read the content.
    Can anybody help me.
    Thanks in advance...
    Message was edited by:
    VeeraLakshmi

    Why don't you use HttpUrlConnection class to retrieve data from HTTP server? This class already supports chunked encoding...
    If you want to do anything by yourself then you need to read HTTP RFC and find all required information. Well in two words you may reject advanced encoding by specifying HTTP 1.0 in your request or download chunked answer manually. Read RFC anyway :)

  • How to read the content of a text file (by character)?

    Guys,
    Good day!
    I'm back just need again your help. Is there anyone knows how to read the content of a text file not by line but by character.
    Please help me. Thank you so much in advance.
    Jojo

    http://java.sun.com/javase/6/docs/api/index.html
    package java.io
    InputStream.read(): int
    Reads the next byte of data from the input stream.
    Implementation:
    InputStreamReader
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • My iPhone 5 has broken and is being replaced with a new iPhone tomorrow. However, My carrier (orange) will b picking up my broken iPhone and I am unsure how to secure the content and icloud data on the broken phone. Is there a way to display the data?

    My iPhone 5 has broken and is being replaced with a new iPhone tomorrow. However, My carrier (orange) will b picking up my broken iPhone and I am unsure how to secure the content and icloud data on the broken phone. Is there a way to disable the data held on it and ensure that if it is fixed, nobody can use/see my data and access my account?

    Hi Gazpan,
    Thanks for visiting Apple Support Communities.
    I recommend using the steps in this article to back up your iPhone if possible:
    iOS: Back up and restore your iOS device with iCloud or iTunes
    http://support.apple.com/kb/ht1766
    You may also find this advice helpful for your situation:
    What to do before selling or giving away your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/ht5661
    If you no longer have your iOS device
    If you're using iCloud and Find My iPhone on the device, you can erase the device remotely and remove it from your account by signing in to icloud.com/find, selecting the device, and clicking Erase. When the device has been erased, click Remove from Account.
    If you're unable to complete either of the above steps, you should change your Apple ID password. Changing your password won't remove any personal information that is cached on the device, but it will make sure that the new owner can't delete your information from iCloud.
    Cheers,
    Jeremy

  • How to print the contents of a form(window)

    I'm devloping visitors application in java. After the data entry, I need to display the selected information from database along with the photo and take a printout so that it looks like a card.
    I know how to display the contents in a form. How do I print the contents of the form?
    -Thanx
    Hane

    in JComponent there is a method called print(Graphics g)
    you can use that with a Printable class
    read bout the java.print package in the java doc

  • How to get the content in embed swf file in Swf Loader on run time

    How to get the content in embed swf file in Swf Loader on run time
    [Bindable]
    [Embed(source="assets/index.swf")]
       private var SWFSRC:Class;
    <mx:SWFLoader id="_swfloader" source="{SWFSRC}" />

    Hi Flex harUI,
    Throw the error.
    Access of undefined property content

  • How to find the contents of proc from top command

    I had a doubt related to how to find the contents of a procedure or the statements from the PID displayed in top command if it can be done from TOAD or
    sqlplus. If we can find out the details from top like:-
    21211 oracle 16 0 3228 1012 764 R 0 0.0 0:07.68 top
    1 root 16 0 1732 552 472 S 0 0.0 0:01.29 init
    say, what is the process with PID 21211 and 1 are doing?
    I hope, my question is clear.
    Please, help in solving the doubt.
    regards

    Join v$process, v$session, and v$sql
    SQL> ed
    Zapisano file afiedt.buf
      1  SELECT p.pid, s.sid, s.serial#, sq.sql_text
      2    FROM v$session s,
      3      v$process p,
      4      v$sql sq
      5    WHERE s.paddr = p.addr
      6*   AND sq.address = s.sql_address
    SQL> /
           PID        SID    SERIAL# SQL_TEXT
            37        128          2 BEGIN EMD_NOTIFICATION.QUEUE_READY(:1, :
                                     2, :3); END;
            19        149       4566 SELECT p.pid, s.sid, s.serial#, sq.sql_t
                                     ext   FROM v$session s,     v$process p,
                                          v$sql sq   WHERE s.paddr = p.addr
                                      AND sq.address = s.sql_address
    SQL>Edited by: Łukasz Mastalerz on Feb 12, 2009 1:27 PM

  • How to transfer the contents of my smartphone to my new iphone, icloud accepts content from other smartphones?

    Hi community
    how to transfer the contents of my smartphone to my new iphone, icloud accepts content from other smartphones?
    ty for help
    Olib

    If you haven't set up your new iMac yet use Setup Assistant when you do. If you have, use Migration Assistant http://support.apple.com/kb/HT4889

Maybe you are looking for