Get result from PL/SQL function through XDBUri (10g)

Hi!
I have to call a PL/SQL function that takes two parameters and return one parameter. (I will do this from Oracle Service Bus).
It is possible to get relational data as xml through an XDBUri type over http by using the XML DB functionality. But is it possible to get the result of a PL/SQL function as XML as well?
I have tried to wrap the PL/SQL procedure inside a view, but cant get the variable to be bound into the sql.
I have tried with stuff like this:
create or replace view test (a, b)
as
select function(a, b) from dual
But since I dont have a table returning the values i cant get it work.
If I can make this view, I can call it through the XDMUri type.
Sombody that can help me to manage this?
/Helge
Edited by: user3169245 on 03.apr.2009 12:06

Here's a code snippet that may help
package com.oracle.st.xmldb.pm.xfiles;
import com.oracle.st.xmldb.pm.multipart.InputStreamProcessor;
import com.oracle.st.xmldb.pm.multipart.MultipartInputStream;
import java.io.IOException;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import oracle.jdbc.OracleConnection;
import oracle.jdbc.OracleDriver;
import oracle.jdbc.OracleCallableStatement;
import com.oracle.st.xmldb.pm.multipart.MultipartProcessor;
import com.oracle.st.xmldb.pm.multipart.MultipartProcessorImpl;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.sql.DatabaseMetaData;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Enumeration;
import oracle.jdbc.OraclePreparedStatement;
import oracle.jdbc.OracleResultSet;
import oracle.jdbc.OracleTypes;
import oracle.sql.BLOB;
import oracle.sql.CLOB;
import oracle.xdb.XMLType;
import oracle.xml.parser.v2.XMLDocument;
import org.w3c.dom.Attr;
import org.w3c.dom.CDATASection;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
public class XFilesServlet extends HttpServlet implements InputStreamProcessor {
    public static String TARGET_PATH      = "target";
    public static String STYLESHEET_PATH      = "stylesheet"; 
    private static String CREATE_RESOURCE_SQL =
    "begin " +
    "  XFILES_SOAP_SERVICES.UPLOADRESOURCE" +
    "  ( " +
    "    P_RESOURCE_PATH => :1, " +
    "    P_CONTENT => :2, " +
    "    P_CONTENT_TYPE => :3," +
    "    P_DESCRIPTION => :4," +
    "    P_LANGUAGE => :5," +
    "    P_CHARACTER_SET => :6," +
    "    P_DUPLICATE_POLICY => :7" +
    "  );" +
    "end;";
    private static String GET_FOLDER_HTML_PAGE_SQL =
    "select xdburitype('/XFILES/lite/Folder.html').getClob() from dual";
    private static String WRITE_LOG_RECORD_SQL =
    "begin xfiles_logging.enqueue_log_record(:1); end;";
    private OracleConnection dbConnection;
    private OracleCallableStatement createResource;
    private OracleCallableStatement writeLogRecord;
    private DatabaseMetaData dbMetadata;
    private static final int FILE_UPLOAD = 1;
    private static final int PUBLISH_RSS = 2;
    private static final int DB_REST_SERVICE = 3;
    private static final int FORCE_AUTHENTICATION = 4;
    private static final int SET_PASSWORD = 5;
    private static final int DISPLAY_XML = 6;
    private static final int ENABLE_RSS = 7;
    public static final int XDB_ACCESS_DENIED = 31050;
    private static String SERVLET_ROOT = "/sys/servlets/XFILES";
    private static final String FILE_UPLOAD_PATH = "fileUpload";
    private static final String PUBLISH_RSS_PATH = "publishRSS";
    private static final String SET_PASSWORD_PATH = "setPassword";
    private static final String DB_REST_SERVICE_PATH = "dbRestService";
    private static final String FORCE_AUTHENTICATION_PATH = "doAuthentication";
    private static final String DISPLAY_XML_PATH = "displayXML";
    private static final String ENABLE_RSS_PATH = "enableRSS";
    public static String POST_UPLOAD_URL = "postUploadRedirect";
    public static String DULPLICATE_POLICY = "duplicatePolicy";
    public static String SOURCE_FILE_PATH = "sourceFilePath";
    public static String RESOURCE_FILENAME = "targetFileName";
    public static String RESOURCE_DESCRIPTION = "description";
    public static String UPLOAD_LANGUAGE = "UploadLanguage";
    public static String UPLOAD_CHARACTERSET = "UploadCharset";
    public static String PASSWORD = "password";
    public static String XML_DOCUMENT = "content";
    public static String XML_CHUNK = "chunk";
    public static String RESOURCE_ID = "resid";
    public static String DATABASE_SCHEMA = "DatabaseSchema";
    public static String PACKAGE  = "Package";
    public static String METHOD = "Method";
    public static String SQL_CALL = "SqlOperation";
    protected XMLDocument logRecord;
    protected Element parameterList;
    protected Element timings;
    protected int currentOperation;
    public String xmlContent;
    public static String XML_TIMESTAMP_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS000";
    public static String LOG_TIMESTAMP_FORMAT = "HH:mm:ss.SSS000";
    protected SimpleDateFormat xmlDateFormatter  = new SimpleDateFormat(XML_TIMESTAMP_FORMAT); 
    private String postUploadURL;
    private String targetFolder;
    private String onDuplicateAction;
    private String sourceFile;
    private BLOB   resourceContent;
    private String contentType;
    private String resourceName;
    private String resourceComment;
    private String uploadLanguage;
    private String uploadCharacterSet;
    public XFilesServlet() {
    private void logParameter(Document doc)
       this.parameterList.appendChild(logRecord.importNode(doc.getDocumentElement().cloneNode(true),true));
    private void logParameter(String parameterName, String[] values)
      Element e = this.logRecord.createElement(parameterName);
      this.parameterList.appendChild(e);
      if (values != null)
        Attr a = this.logRecord.createAttribute("Length");
        e.setAttributeNode(a);
        a.setValue(Integer.toString(values.length));
        for (int i = 0; i < values.length; i++)
          Element v = this.logRecord.createElement("parameterValue");
          e.appendChild(v);
          Text t = this.logRecord.createTextNode(values);
v.appendChild(t);
a = this.logRecord.createAttribute("Index");
v.setAttributeNode(a);
a.setValue(Integer.toString(i));
public void logParameter(String parameterName,String value)
Element e = this.logRecord.createElement(parameterName);
this.parameterList.appendChild(e);
if (value != null)
Text t = this.logRecord.createTextNode(value);
e.appendChild(t);
private void logParameterCDATA(String parameterName,String value)
Element e = this.logRecord.createElement(parameterName);
this.parameterList.appendChild(e);
if (value != null)
CDATASection c = this.logRecord.createCDATASection(value);
e.appendChild(c);
private void logException(Exception e) {
Element stackTrace = this.logRecord.createElement("StackTrace");
this.logRecord.getDocumentElement().appendChild(stackTrace);
this.appendException(stackTrace,e);
private void appendException(Element stackTrace, Throwable error)
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
error.printStackTrace(pw);
pw.flush();
pw.close();
Text t = this.logRecord.createCDATASection(sw.toString());
stackTrace.appendChild(t);
if (error.getCause() != null)
Element causedBy = this.logRecord.createElement("CausedBy");
stackTrace.appendChild(causedBy);
appendException(causedBy,error.getCause());
else {
if (error instanceof ServletException) {
ServletException se = (ServletException) error;
if (se.getRootCause() != null) {
Element causedBy = this.logRecord.createElement("CausedBy");
stackTrace.appendChild(causedBy);
appendException(causedBy,se.getRootCause());
private void logTimestamp(String eventName)
Timestamp ts = new Timestamp(System.currentTimeMillis());
Element element = logRecord.createElement(eventName);
this.timings.appendChild(element);
Text text = logRecord.createTextNode(this.xmlDateFormatter.format(ts));
element.appendChild(text);
protected void initiateLogging(HttpServletRequest request)
throws IOException
this.logRecord = new XMLDocument();
Element root = this.logRecord.createElement("XFilesLogRecord");
this.logRecord.appendChild(root);
Element e = this.logRecord.createElement("HttpRequest");
root.appendChild(e);
Element e1 = this.logRecord.createElement("ServletName");
Text t = this.logRecord.createTextNode(this.getClass().getName());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("HttpMethod");
t = this.logRecord.createTextNode(request.getMethod());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RequestURI");
t = this.logRecord.createTextNode(request.getRequestURI());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("PathTranslated");
t = this.logRecord.createTextNode(request.getPathTranslated());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RequestURL");
t = this.logRecord.createTextNode(new String(request.getRequestURL()));
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("Protocol");
t = this.logRecord.createTextNode(request.getProtocol());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("ServerName");
t = this.logRecord.createTextNode(request.getServerName());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("ContentType");
t = this.logRecord.createTextNode(request.getContentType());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("LocalAddr");
t = this.logRecord.createTextNode(request.getLocalAddr());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("LocalName");
t = this.logRecord.createTextNode(request.getLocalName());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("LocalPort");
t = this.logRecord.createTextNode(Integer.toString(request.getLocalPort()));
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("Port");
t = this.logRecord.createTextNode(Integer.toString(request.getServerPort()));
e1.appendChild(t);
e.appendChild(e1);
this.timings = this.logRecord.createElement("Timestamps");
root.appendChild(this.timings);
logTimestamp("Init");
e = this.logRecord.createElement("Remote");
root.appendChild(e);
e1 = this.logRecord.createElement("RemoteHost");
t = this.logRecord.createTextNode(request.getRemoteHost());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RemoteAddress");
t = this.logRecord.createTextNode(request.getRemoteAddr());
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RemotePort");
t = this.logRecord.createTextNode(Integer.toString(request.getRemotePort()));
e1.appendChild(t);
e.appendChild(e1);
e1 = this.logRecord.createElement("RemoteUser");
t = this.logRecord.createTextNode(request.getRemoteUser());
e1.appendChild(t);
e.appendChild(e1);
e = this.logRecord.createElement("RequestHeaders");
root.appendChild(e);
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements())
String headerName = (String) headerNames.nextElement();
e1 = this.logRecord.createElement(headerName);
t = this.logRecord.createTextNode(request.getHeader(headerName));
e1.appendChild(t);
e.appendChild(e1);
this.parameterList = this.logRecord.createElement("ServletParameters");
root.appendChild(parameterList);
public void writeLogRecord(XMLDocument logRecord) throws SQLException , IOException {
XMLType xml = new XMLType(this.dbConnection, logRecord);
this.writeLogRecord.setObject(1, xml);
this.writeLogRecord.execute();
this.dbConnection.commit();
protected String readParameter(HttpServletRequest request,String parameterName,String defaultValue)
String value = request.getParameter(parameterName);
if (value != null)
if (value.length() == 0) {
value = null;
if (value == null) {
value = defaultValue;
logParameter(parameterName,value);
return value;
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException
try {
try {  
initiateLogging(request);
initializeDatabaseConnection();
String requestURI = request.getRequestURI();
this.currentOperation = getOperation(requestURI);
switch (this.currentOperation) {
case DB_REST_SERVICE:
restResponse(request,response);
break;
default:
response.sendError(HttpServletResponse.SC_NOT_FOUND);
logTimestamp("Complete");
writeLogRecord(this.logRecord);
this.dbConnection.commit();
catch (Exception e) {
try {
this.dbConnection.rollback();
logTimestamp("Exception");
logException(e);
writeLogRecord(this.logRecord);
catch (Exception wle) {
System.out.println("XFilesServlet : Fatal error while logging Error : ");
e.printStackTrace(System.out);
System.out.flush();
wle.printStackTrace(System.out);
System.out.flush();
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
finally {
try {
this.createResource.close();
this.writeLogRecord.close();
catch (SQLException e) {
System.out.println("XFilesServlet : Fatal error while closing statements : ");
e.printStackTrace(System.out);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
} catch (IOException ioe) {
System.out.println("XFilesServlet : Fatal error while Sending Error Status : ");
ioe.printStackTrace(System.out);
System.out.flush();
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
doGet(req, res);
private void initializeDatabaseConnection() throws SQLException {
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
OracleDriver ora = new OracleDriver();
this.dbConnection = (OracleConnection) ora.defaultConnection();
this.createResource = (OracleCallableStatement) this.dbConnection.prepareCall(this.CREATE_RESOURCE_SQL);
this.writeLogRecord = (OracleCallableStatement) this.dbConnection.prepareCall(this.WRITE_LOG_RECORD_SQL);
this.dbMetadata = this.dbConnection.getMetaData();
private int getOperation(String requestURI) {
String servletTarget = requestURI.substring(this.SERVLET_ROOT.length()+1);
if (servletTarget.indexOf('/') > -1) {
servletTarget = servletTarget.substring(0,servletTarget.indexOf("/"));
if (servletTarget.equals(this.FILE_UPLOAD_PATH)) return FILE_UPLOAD;
if (servletTarget.equals(this.FORCE_AUTHENTICATION_PATH)) return this.FORCE_AUTHENTICATION;
if (servletTarget.equals(this.PUBLISH_RSS_PATH)) return this.PUBLISH_RSS;
if (servletTarget.equals(this.DB_REST_SERVICE_PATH)) return this.DB_REST_SERVICE;
if (servletTarget.equals(this.SET_PASSWORD_PATH)) return this.SET_PASSWORD;
if (servletTarget.equals(this.DISPLAY_XML_PATH)) return this.DISPLAY_XML;
if (servletTarget.equals(this.ENABLE_RSS_PATH)) return this.ENABLE_RSS;
return 0;
public void processParameter(String name, String value)
throws SQLException {
logParameter(name,value);
if (name.equals(this.TARGET_PATH)) {
this.targetFolder = value;
if (name.equals(this.POST_UPLOAD_URL)) {
this.postUploadURL = value;
if (name.equals(this.UPLOAD_LANGUAGE)) {
this.uploadLanguage = value;
if (name.equals(this.UPLOAD_CHARACTERSET)) {
this.uploadCharacterSet = value;
if (name.equals(this.DULPLICATE_POLICY)) {
this.onDuplicateAction = value;
if (name.equals(this.SOURCE_FILE_PATH)) {
this.sourceFile = value;
if (name.equals(MultipartProcessor.MULTIPART_CONTENT_TYPE)) {
this.contentType = value;
if (name.equals(this.RESOURCE_FILENAME)) {
this.resourceName = value;
if (name.equals(this.RESOURCE_DESCRIPTION)) {
this.resourceComment = value;
createNewResource();
private void restResponse(HttpServletRequest request, HttpServletResponse response)
throws IOException, SQLException, ServletException {
String requestURI = request.getRequestURI();
String restTarget = requestURI.substring(this.SERVLET_ROOT.length() + this.DB_REST_SERVICE_PATH.length()+1);
if (restTarget.contains("//")) {
// Cannot have // in URL
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
if (restTarget.length() < 4) {
// URL is too short to be valid - Minumum is /A/B
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
if (!restTarget.startsWith("/")) {
// Invalid URL
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
if (!restTarget.substring(1).contains("/")) {
// URL must contain /Schema/Method, may Contain /Schema/Package/Method
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
String schemaName = restTarget.substring(1,restTarget.substring(1).indexOf("/")+1);
restTarget = restTarget.substring(schemaName.length()+1);
logParameter(this.DATABASE_SCHEMA,schemaName);
String packageName = null;
if (restTarget.substring(1).contains("/")) {
// URL contains /Schema/Package/Method
packageName = restTarget.substring(1,restTarget.substring(1).indexOf("/")+1);
restTarget = restTarget.substring(packageName.length()+1);
logParameter(this.PACKAGE,packageName);
if (restTarget.substring(1).contains("/")) {
// URL must be /Schema/Method or /Schema/Package/Method, anything else is junk
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
String methodName = restTarget.substring(1);
logParameter(this.METHOD,methodName);
int responseCode = verifyTarget(request,schemaName,packageName,methodName);
if (responseCode != HttpServletResponse.SC_OK) {
System.out.println("Status Code = " + responseCode);
response.sendError(responseCode);
return;
String target = "\"" + schemaName + "\".";
if (packageName != null) {
target = target + "\"" + packageName + "\".";
target = target + "\"" + methodName + "\"";
int index;
Enumeration parmNames;
String sqlStatementText =
"begin" + "\n" +
" :1 := " + target + "(" + "\n";
index = 1;
parmNames = request.getParameterNames();
while (parmNames.hasMoreElements()) {
index++;
sqlStatementText = sqlStatementText + "\"" + parmNames.nextElement() + "\" => :" + index + " ";
if (parmNames.hasMoreElements()) {
sqlStatementText = sqlStatementText + ",\n";
sqlStatementText = sqlStatementText + ");\nend;";
logParameterCDATA(this.SQL_CALL,sqlStatementText);
OracleCallableStatement statement = (OracleCallableStatement) this.dbConnection.prepareCall(sqlStatementText);
index = 1;
parmNames = request.getParameterNames();
while (parmNames.hasMoreElements()) {
index++;
String parameterName = (String) parmNames.nextElement();
String parameterValue = (String) request.getParameter(parameterName);
logParameter(parameterName,parameterValue);
statement.setString(index,parameterValue);
XMLType xml = null;
try {
statement.registerOutParameter(1,OracleTypes.OPAQUE,"SYS.XMLTYPE");
statement.execute();
xml = (XMLType) statement.getObject(1);
statement.close();
catch (SQLException sqle) {
statement.close();
if (xml != null) xml.close();
if (sqle.getErrorCode() == this.XDB_ACCESS_DENIED) {
logTimestamp("RequestAuthorization");
response.sendError(HttpServletResponse.SC_UNAUTHORIZED);
return;
ServletException se = new ServletException("Unexpected SQL Error",sqle);
throw se;
response.setContentLength(0);
response.setContentType("text/xml");
xml.writeToOutputStream(response.getOutputStream());
xml.close();
response.getOutputStream().flush();
response.getOutputStream().write( new byte[] {'\r','\n'} );
// response.getOutputStream().flush();
response.getOutputStream().close();
response.setStatus(HttpServletResponse.SC_OK);
private int verifyTarget(HttpServletRequest request, String schemaName, String packageName, String methodName)
throws SQLException {
int response = HttpServletResponse.SC_NOT_FOUND;
boolean parameterValid = false;
ResultSet procedure = null;
procedure = this.dbMetadata.getProcedures(packageName,schemaName,methodName);
while (procedure.next()) {
response = HttpServletResponse.SC_OK;
response = verifyMandatoryParameters(request,schemaName,packageName,methodName);
if (response == HttpServletResponse.SC_OK) {
response = verifyOptionalParameters(request,schemaName,packageName,methodName);
return response;
private int verifyMandatoryParameters(HttpServletRequest request, String schemaName, String packageName, String methodName) throws SQLException {
// Check Mandatory Parameters are present.
ResultSet columns = null;
columns = this.dbMetadata.getProcedureColumns(packageName,schemaName,methodName,"%");
while (columns.next()) {
short nullable = columns.getShort(12);
String columnName = columns.getString(4);
if (nullable == DatabaseMetaData.procedureNoNulls) {
if (request.getParameter(columnName) == null) {
columns.close();
return HttpServletResponse.SC_BAD_REQUEST;
return HttpServletResponse.SC_OK;
private int verifyOptionalParameters(HttpServletRequest request, String schemaName, String packageName, String methodName) throws SQLException {
// Check Optional Parameters are valid
Enumeration parms = request.getParameterNames();
ResultSet column = null;
while (parms.hasMoreElements()) {
String columnName = (String) parms.nextElement();
column = this.dbMetadata.getProcedureColumns(packageName,schemaName,methodName,columnName);
if (!column.next()) {
column.close();
return HttpServletResponse.SC_BAD_REQUEST;
column.close();
return HttpServletResponse.SC_OK;

Similar Messages

  • Getting result from a telnet command through Java

    Hi,
    I've been using a set of classes found here: http://javatelnet.org/
    to do telnet through Java in a non-interactive mode.
    However I've got a problem when retrieving the result of a command sent to the remote host: the classes read the stream until the prompt is encountered; my problem is I must execute commands on several remote hosts, and the prompt is not necessarily the same on all hosts.
    Is there a simple means to establish a telnet connection through Java and retrieve the result of the commands?
    Any help would be appreciated.

    Thanks again, this is a very good article
    I see it is still the same strategy to get the result of a command : wait 'til the prompt is sent. Maybe there is just no other way to get it .
    But as I don't know the prompt on the different hosts I have to query, this won't do it.
    The article gave me an idea though : I only need to count the files in a directory on the remote host; until now I was trying to send the 'ls | wc -l' command by Telnet.
    Maybe I can simply do it by FTP (retrieve the list of files, and then count the lines with JAVA).

  • How to Create PR from exeternal SQL Server through IDOC

    Dear all,
    I am in trouble while creating PR from exeternal SQL Server through IDOC . although I have created PR from TCODE we19 giving input as well as from function writen below
    My scnerio is from external system(Sql) want to send data to sap to create PR return PR No to SQl Server
    Not having idea how to do
    Basic Type for Idoc : PREQCR01
    Message Type       : PREQCR
    Function Module    : BAP_Idoc_Input1
    Thanxs in Advance

    if you have XI installed,
    than it would be easy,
    just use JDBC channel->XI->SAP IDOC.
    otherwise,
    you can export the table from the SQL to CSV file,
    and import it with LSMW with IDOC PREQCR01.

  • Get result from google by java

    after greeting
    i want to know how to make search and get result from google through jsp and display it in jsp
    if anyone has answer
    please send me it as soon as possible
    thanks

    Check what API's google provides and make use of it.
    Start here: [http://code.google.com].

  • How  to get  response from such a  function

    How  to get  response from such a  function (in MODULE USER_COMMAND_0010 INPUT I get "ODGOVOR" 'X'
    FUNCTION Z_SEENKRAT.
    ""Local Interface:
    *"  EXPORTING
    *"     REFERENCE(ODGOVOR) TYPE  MSEG-KZEAR
    DATA ok_code LIKE sy-ucomm.
    DATA: test like mseg-kzear.
    BREAK-POINT.
    call screen 10.
    test = ODGOVOR.
    ENDFUNCTION.
    *&      Module  CLEAR_OK_CODE  OUTPUT
          text
    MODULE clear_ok_code OUTPUT.
      CLEAR ok_code.
    ENDMODULE.                 " CLEAR_OK_CODE  OUTPUT
    *&      Module  USER_COMMAND_0010  INPUT
          text
    MODULE USER_COMMAND_0010 INPUT.
    DATA odgovor LIKE mseg-KZEAR.
    CASE ok_code.
        WHEN 'DA'.
        ODGOVOR = 'X'.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0010  INPUT

    Hi,
    You need to declare the ODGOVOR variable in the TOP include, then you will get the value
    Regards
    Sudheer

  • How to export the result from executing sql statement to excel file ?

    HI all,
    Great with Oracle SQL Developer, but I have have a trouble as follwing :
    I want to export the result from executing sql statement to excel file . I do easily like that in TOAD ,
    anyone can help me to do that ? Thanks so much
    Sigmasvn

    Hello Sue,
    I just tried to export to excel with the esdev extension and got java.lang.NumberFormatException. I found the workaround at Re: Windows Multi-language env, - how do I set English for application lang?
    open the file sqldeveloper\jdev\bin\sqldeveloper.conf and add the following two lines:
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=USyet now my date formats in excel are 'american-style' instead of german. For example 01-DEC-01 so excel does not recognize it as date and therefore I can not simply change the format.
    When export to excel will be native to 1.1 perhaps someone can have a look at this 'feature'
    Regards
    Marcus

  • Web services and ADF 11g- get Result from backing bean

    I'm executing an action from backing bean (call Web service that returns complex data types)
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("unesiPonudu");
    Object result = operationBinding.execute();
    result is instance of oracle.adf.model.adapter.dataformat.XMLHandler$DataCollection but DataCollection is not accessible.
    How to get results from method?
    Tnx,
    Andreja

    Hi,
    there should be a result iterator in the Executables section which cotnains the result. If not, create it from the WS result entry in the DC palette. Once this iterator gets updated, you get the data from this iterator as it would be the case of a table accesses the WS
    Frank

  • How BW get data from MS SQL server DB?

    I got infomation about this from help.com, http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm.
    this web told me, when BW application server must be Win NT.BW can get data from MS SQL server DB.
    but our BW application server was AIX.
    Did you know other solution to this?

    Hi,
    you need to use the DBConnect or in BI7.0 the UDConnect features.
    regards
    Siggi
    See also: http://help.sap.com/saphelp_nw70/helpdata/EN/a1/89786c3df35c4ea930a994e884bb4c/frameset.htm
    or
    http://help.sap.com/saphelp_nw70/helpdata/EN/44/bcdce1dcaf56a3e10000000a1553f6/frameset.htm
    Edited by: Siegfried Szameitat on Aug 13, 2008 9:16 AM

  • Forgot icloud password, how to get it recover without any question and also alternative email becuase someone hacked my alternative email id. need password for using icloud hopefully i will get result from you as your earliest.

    forgot icloud password, how to get it recover without any question and also alternative email because someone hacked my alternative email id. need password for using icloud hopefully i will get result from you as your earliest.

    I'm sorry, but I know nothing about iCloud email. I stayed away from iCloud email and only use iCloud for limited purposes.
    But take a look at this discussion and read the response from randers4. He is one of the iCloud experts in the Apple Support Communities.
    https://discussions.apple.com/message/24358339#24358339
    If that doesn't help, you might be better off posting in here where there are other more knowledgable iCloud users.
    https://discussions.apple.com/community/icloud/icloud_on_my_ios_device

  • Migration from MS SQL Server to Oracle 10g

    Hi,
    In our application, we are planning to refresh data every one hour from MS SQL Server to Oracle 10g. Can anyone tell me what approach can be followed?
    Thanks & Regards,
    Faizal MK

    Hello,
    migrations can be done with the Migration Workbench that is included in the SQL Developer: http://www.oracle.com/technology/tech/migration//workbench/index_sqldev_omwb.html
    But your question sounds more like a replication of data than a migration. Please read as a starter the following note in My Oracle Support (former Metalink):
    Note 283700.1: How to replicate Data between Oracle and a Foreign Datasource
    That note describes ways for the replication in both directions. Please let me know whether this is helpful for you.
    Best regards
    Wolfgang Kobarg-Sachsse

  • Interactive report from PL/SQL function

    Hello All,
    i have a pl/sql function that dynamically builds up a sql query and returns it as a varchar2.
    when i create a new report then i can use this function in the report like
    return f_function(param1,param2,v('APP_ID'), v('APP_SESSION'));
    and this works fine.
    Except i cannot create an interactive report for this function, because it is not allowed !!!!
    So how can i use the function in an interactive report ?
    Thanks in advance,
    Marco

    Marco,
    Another rather extreme approach would be to go all the way and make your function pipelined (that is not only build but also execute the query) and then select from it in your interactive report.
    The disadvantage here would be that any supplementary filtering would act on the result set of the function (not as an addition to the where clause of the original query). But if you can live with that...
    The advantage would be that there's less fiddling with column headers.
    Regards,
    Iulian

  • How to get result from another JSP file?

    I have to write a jsp (my.jsp) to get information from another jsp file (other.jsp).
    The other.jsp return integer value (0 / 1) so that user can tell if certain service is available or not. And in my.jsp I need to collect such result and other information from a text file to make up of a XML string.
    How can I call other.jsp to get the result? Thanks a lot.

    Hi, I think I didn't describe the problem clearly
    enough. In fact, there is a JSP file, and if our
    database is currently connected, the JSP will return
    value 1, otherwise, it will return 0. My java program
    need to get that result, and then form an XML string,
    and send the string back to the client. I'm just
    wonder how can I write such a program to read result
    from JSP file. Thanks a lot.Why is this function implemented as a JSP file? It should be implemented as a bean. It would be simple to get the information you require from that bean.

  • Different result from same SQL statement

    The following SQL statement brings back records using query
    analyzer on the SQL server. However when I run it in a cold fusion
    page it comes back with no results. Any idea why????????
    SELECT COUNT(h.userID) AS hits, u.OCD
    FROM dbo.tbl_hits h INNER JOIN
    dbo.tlkp_users u ON h.userID = u.PIN
    WHERE (h.appName LIKE 'OPwiz%') AND (h.lu_date BETWEEN
    '05/01/07' AND '06/01/07')
    GROUP BY u.OCD
    ORDER BY u.OCD

    Anthony Spears wrote:
    > That didn't work either.
    >
    > But here is something interesting. If we use the dates
    05/01/2007 and
    > 06/01/2007 we get results in SQL Server Query Analyzer
    but not using a cold
    > fusion page. But if we use the dates 05/01/2007 and
    09/01/2007 both get back
    > the same results.
    >
    Are you absolutely, 100% sure that you are connecting to the
    same
    database instance with both CF and Query Analyzer? That kind
    of symptom
    is 9 out of 10 times because the user is looking at different
    data. One
    is looking at production and the other development or an
    backup or
    recent copy or something different.

  • Dynamic action setvalue from pl/sql function

    Hi,
    I have a currency table with exchange rate column.
    I created a form that allow user to select currency from the table and get the rate into Px_RATE page items.
    I would like to implement it using Dynamic action in apex 4
    Please help me on this case
    Thanks & regards

    Hi,
    You can achieve this by defining a dynamic action as follows...
    #1 - Right click on the page item used to select the currency (let's call it P1_CURRENCY for purposes of this example) and select 'Create Dynamic Action'
    #2 - Select 'Advanced' as we're going to use the 'Set Value' dynamic action type, which is not available in the 'Standard' branch of the wizard.
    #3 - Name your dynamic action, say 'GET RATE', click 'Next'.
    #4 - Leave the 'When' attributes as default, this just defines that the dynamic action will fire whenever the currency item changes, click 'Next'.
    #5 - For the 'True Action > Action' select 'Set Value'
    #6 - Think about whether you want to set the value on page load from the dynamic action also, if so leave the 'Fire on Page Load' checkbox checked.
    #7 - [Assuming you have a simple PL/SQL API that returns the rate, say get_rate for example] Select 'Set Type' of 'PL/SQL Function Body'
    #8 - For 'PL/SQL Function Body' specify something like: return get_rate(:P1_CURRENCY);#9 - For 'Page Items to Submit', specify the currency item P1_CURRENCY and click 'Next'
    #10 - For the 'Affected Elements' specify 'Item' and then select the page item where you want to return the rate value, say P1_RATE.
    #11 - Click 'Create'.
    Let me know if this works for you or if you have any further questions.
    Regards,
    Anthony.

  • Two statements, get results from the first statement?

    Ok maybe I made it sound a little harder than it is, but this is what I am trying to do. I have a result set from from a database call when I pass in the username and password . In the 1st call I get the Users info: User_ID, first_name, lastname, etc...
    But I either need to get info from the first statement, and pass it to the 2nd statement or just do two statement calls calling the same info and passing it to my user object? I dont know which if any is faster, or better. The only thing I need from the first statement is the user_id. In the 2nd statement I need the user_id to find out the user permissions.
    Here is the original code when It was getting the user info and permissions from the same table. try
               dba = new DbAccess();
               java.sql.Connection con = dba.getConnection();          
    java.sql.DriverManager.getConnection("jdbc:oracle:thin:@kares:1523:appd","user","pass");  
               ps = con.prepareStatement("SELECT USER_ID, LAST_NAME, FIRST_NAME, LOGIN, PASSWORD," +
               "X, Y, Z FROM RD_USERS WHERE LOGIN=? and PASSWORD=?");
               ps.setString(1, user);
               ps.setString(2, pass);
               rs = ps.executeQuery();
               // set the user attributes
               if ( rs.next() )
                  loginValid = true;
                  setUserId(rs.getInt("USER_ID"));
                  setLastName(rs.getString("LAST_NAME"));
                  setFirstName(rs.getString("FIRST_NAME"));
                  setLoginName(rs.getString("LOGIN"));
                  setPassword(rs.getString("PASSWORD"));   
                  X = rs.getBoolean("X");
                  setX(X);
                  Y = rs.getBoolean("Y");
                  setY(Y);
                  Z = rs.getBoolean("Z");
                  setZ(Z);
               else
                  setLastName(null);
                  setFirstName(null);
                  setLoginName(null);
                  setPassword(null);
                  setX(false);
                  setY(false);
                  setZ(false);
               rs.close(); rs = null;
               ps.close(); ps = null;
               //dba.close(); dba = null;
            } The code above gets the info from one table, I now need to get the X, Y, and Z from a different table, but I need the USER_ID first. So, the first table is set up with the user_id and user info, and the 2nd table is set up with the user_id and user permissions

    Thanks DrClap I started on the the query and I did it a little differently, but it should hopefull do the same thing. my tables are constructed as so:
    USER
         USER_ID
         FIRST_NAME
         LAST_NAME
         USER_NAME
         PASSWORD
         ETC....
    USER_PERMISSIONS
         USER_ID
         PERMISSION X
         PERMISSION Y
         PERMISSION Z
         ETC....
    My Select looks something like this
    ps = con.prepareStatement("SELECT a.USER_ID, a.LAST_NAME, a.FIRST_NAME, a.USER_NAME, a.USER_PASSWORD," +
               "b.X, b.Y, b.Z FROM RD_USERS a, RD_PERMISSIONS b WHERE USER_NAME=? and USER_PASSWORD=?");
    This is where I come to a crossroads, Can I add on another AND to say "WHERE a.USER_ID = b.USER_ID
    and do I use the =, or is it ==, or .equals(). Thanks in advance.
    orozcom

Maybe you are looking for

  • How to implement multiple Value Helps within the same Application ??

    Dear Experts, I want to implement multiple value helps in the same view.For that I have declared exporting parameters of type 'wdy_key_value_table.' within the component controller for each of the value helps.While I do activate and test the applicat

  • How can I find out the audio sampling rate of BetacamSP tape?

    Hi guys I'm trying to digitize BetacamSP tape. But I'm afraid if I might choose wrong setting... This tape is from very long time ago so we don't know which audio sampling rate we recorded with.. How can I find out the audio sampling rate of this Bet

  • ORDVir object type

    First i had a problem with creating tables with image type column. For example, when i typed: CREATE TABLE stockphotos (photo_id NUMBER, photographer VARCHAR2(64), annotation VARCHAR2(255), photo ORDSYS.ORDVir); i got the answere invalid datatype for

  • Unable to Fill in Fillable PDF with Adobe Reader 11

    I have created a fillable pdf using adobe designer 9 and have saved it to be compatible with reader. I sent out the form to several collegues and one person wrote back that they are having issues. The person has adobe reader 11 and cannot save the fo

  • Appropriation of Retained Earnings

    Hi, We are implementing SEM BCS 4.0. The accounting technique is the Equity Method. The SEM-BCS is automatic in the Appropriation of Retained Earnings, but our client makes the Appropriation of Retained Earnings manually in R/3. Is there any way of t