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
-------------------------------------------------------------------
Similar Messages
-
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 regardsErik,
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 -
How to find the value of a variable in other program
How to find the value of a variable in other program say I am in a FM and this FM is being called in from other program and I want to know some of the variable details of the program from the FM itself. Imagine if this is a txn. and I need to know the details from some of the programs while executing the same transaction
Regards
VinHi Vinayak,
you will be having your first program values in internal table or some variables,
when you are calling the second program you wii use like this,
SUBMIT <Second Program Name> USING SELECTION-SCREEN '1000'
WITH s_emp(second program select-options) IN t_emp(first program variables)
WITH p_chk EQ t_chk
WITH p_r1 EQ t_r1
WITH p_month EQ t_month
WITH s_cust1 IN t_cust1
WITH p_r2 EQ t_r2
WITH s_cust2 IN t_cust2
WITH s_week IN t_week
AND RETURN.
you have pas like this to get your first program details. -
How to execute the parametered stored procedure in sql *plus ?
how to execute the parametered stored procedure in sql *plus ?
my storedprocedure format
CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE
(empDOB out date, empEmpName out varchar2)
thanks & regards
mk_murOh, sorry... making many reading-too-fast mistakes today...
You can't declare date variables in SQL*Plus (seel help var), but you can cast to varchar2:
TEST> CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE (empDOB out date, empEmpName out varchar2) IS
2 d date := sysdate;
3 e varchar2(10) := 'bob';
4 begin
5 empdob := d;
6 empempname := e;
7 end;
8 /
Procedure created.
TEST> var d varchar2(30)
TEST> var n varchar2(30)
TEST> call SMS_SELECTMPLOYEE(:d,:n);
Call completed.
TEST> print d n
D
11/07/06
N
bobYoann. -
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 namegetResources 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. -
WD ABAP: How to get the contents of selected table lines?
Hi,
I'm trying to figure out how to get the contents of table lines back from the UI. I display a table with several lines of data. The user selects some rows. I want to move the contents of the selected rows to another table. I have a context attribute, say DATA, with attributes FIELD1... FIELDn, using a DDIC structure. These are bound to the table UI element and the corresponding table columns. To get the selected rows, I use wd_context->get_selected_elements(). This works, but what I get from this method is references to if_wd_context_element. How do I know which row (row number = ?) this corresponds to? And how do I get the actual data? I want a structure with FIELD1 = value1 FIELD2 = value2 etc. My context attributes FIELD refer to table columns, but I'm looking for the table line...
Can somebody help me?
Thanks,
IraHi Ira,
wd_context->get_selected_elements() returns WDR_CONTEXT_ELEMENT_SET which is a table type of IF_WD_CONTEXT_ELEMENT. You can loop through the WDR_CONTEXT_ELEMENT_SET, get into variable say node_elelement which is of type ref to If_Wd_Context_Element. Then you could use the method GET_STATIC_ATTRIBUTES of If_Wd_Context_Element which returns a structure with values of all the attributes in the selected row.
If you need the row number, while populating the node you could have an additional attribute called rowno and populate it correctly. When you select the data using method GET_STATIC_ATTRIBUTES, you would get the appropriate row number.
Regards,
Srini. -
Script logic : determine the content of a variable according to a IF test
Hello experts,
I have the following need in a script logic
determine the content of a variable according to a IF test
For example I tried :
*WHEN %ENTITY%
*IS "CH20","CH30","ES10"
*SELECT(%ENTITYPBPD%, "[ID]", "ENTITYCC", "[ID] = '%ENTITYCC_SET%_PBPD'")
*ENDWHEN
Syntax is correct but I get a query execution error (Error in WHEN/ENDWHEN structure)
I guess it's because this when don't have any REC instructions.
In other words, if the user selection at the package prompt step are CH20, CH30 or ES10
the variable has to be selection_PBPD
if another member is selected
the variable has to take other value
Hope I've made my need clear, and thanks in advance.
G.Hi G,
Will the *TEST_WHEN() statement work for this case?
The way that it works is that if the condition evaluates to TRUE, then the subsequent WHEN...ENDWHEN is processed, else it is not.
Have a look at Page 66 of "How To Use BPC Scripting Logic, Version 1.00, April 21, 2006" (It's a bit old but I use it a lot on our MS7.0 SP9 installation).
Hope this helps.
Regards
Nick -
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 Execute the row by row sql syntax
Hello,
when I execute the below I get the result as attached, how to execute the syntax in each row, Thanks for your help!
select 'select * into TestSSRS.'+ Table_Name + ' from AdventureWorksDW2008R2.'+ Table_Name FROM [dbo].[Tables_To_Copy]Maybe you could store the value of that field in a string variable using a cursor, i expect you dont need to execute this query very often, because using cursor is not always the best option in data sets.
Regards!
Sergio Sánchez Arias
Oaxaca,México
AYÚDANOS A AYUDARTE -
How to execute the packaged procedure(having out param) in TOAD for Oracle
Hi.
Could you help me
How to execute the packaged procedure having out parameters in TOAD for Oralce..
Thanks..Use anonymous PL/SQL block to execute it.
Example.
DECLARE
<out variable name> <out variable data type>;
BEGIN
<package name>.<procedure name>(<out variable name>);
END; -
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 BinhI 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 AhmedIn 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 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. -
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:
VeeraLakshmiWhy 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.
Jojohttp://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.
Maybe you are looking for
-
Entrada da NFe no ERP e arquivamento do XML.
Prezados, bom dia. Tenho algumas dúvidas que gostaria de dividir com vcs. Alguém saberia responder? Processo de Entrada de Nfe no ERP (manual) 1.) Quando da entrada de dados da DANFE no ERP (MIGOMIRO), este envia alguma informação pro GRC? Em que mom
-
Some web sites allow files and free mp3 tracks to be downloaded by right clicking on an icon and selecting "save target as ...". But Firefox does not have this option. How do others handle this? I have had to go back to Internet Explorer to use this
-
Performance tuning for Oracle SOA 11g
Hi, Ours is SOA 11g Environment ver 11.1.1.4.2 on Windows Box. what are the performance tuning steps / guidelines that needs to be followed for SOA 11g in production env Thanks in adv Thanks & Regars, anvv sharma
-
CS5 issue - Selecting TLF text sorta freezes flash
When I use TLF text in CS5 flash seems to use to capacity / I cannot do any clicks for around 10 secs when selecting/deselecting textfield. What could be the reason for flash slowing down so extremely? Im using WinXP, SP3 System: HP xw6600 Workstatio
-
Web AS - ERP 2005 ECC 5.0/6.0 training
Hi experts! I am in urgent need to get training for installation and configuration for ERP 2005 ECC 5.0 or 6.0. Can any one recommend a training course to me? I am looking for a training course that will give me insight and experiense with installing