JDeveloper and PL/SQL queries which return XML

Hi,
I need to deploy WS with JDeveloper. I have an Oracle9i database which I query with PL/SQL. How can I return XML from my PL/SQL queries? I know I can use SQLX to return XML datatypes, but JDeveloper doesn't seem to be compatible. There is also XSQL, but I don't think JDeveloper allows you to publish this as a web service.
Any help would be greatly appreciated!!! Thanks!!!!

The following function should work for what you are trying to do.
htp.p(htf.escape_sc(:P1_ITEM));To escape columns from the database just include it in your select statement:
SELECT htf.escape_sc(COLUMN_NAME) alias
  FROM TABLETo escape items on your apex page:
INSERT INTO table
           (COLUMN_NAME)
     VALUES(htf.escape_sc(:P1_ITEM))Good Luck,
Tyson
Edited by: Tyson Jouglet on Nov 25, 2008 4:12 PM

Similar Messages

  • SQL query  which return all the NET SERVICES which are avaiable in tnsname

    hi all
    how to write a sql query which return all the net services which are avaiable in tnsname.ora
    Regards
    s

    Also, tnsnames.ora is stored on the client, and not necessarily on the server; it's possible (and quite likely) that the name I use for a database in my tnsnames.ora could be different from the name you use for the same database; conversely we might use the same name for two different databases.
    Regards Nigel

  • How to use database control to execute sql queries which change at run time

    Hi all,
    I need to execute sql queries using database controls , where the sql changes
    at run time
    based on some condition. For eg. based on the condition , I can add some where
    condition.
    Eg. sql = select id,name from emp where id = ?.
    based on some condition , I can add the following condition .
    and location = ?.
    Have anybody had this kind of situation.
    thanks,
    sathish

    From the perspective of the database control, you've got two options:
    1) use the sql: keyword to do parameter substitution. Your observation
    about {foo} style sbustitution is correct -- this is like using a
    PreparedStatement. To do substitution into the rest of the SQL
    statement, you can use the {sql: foo} substitution syntax which was
    undocumented in GA but is documented in SP2. Then, you can build up
    the filter clause String yourself in a JPF / JWS / etc and pass it into
    the DB control.
    For example:
    * @jc:sql statement="select * from product {sql: filter}"
    public Product[] getProducts(String filter) throws SQLException;
    This will substitute the String filter directly into the statement that
    is executed. The filter string could be null, "", "WHERE ID=12345", etc.
    2) you can use the DatabaseFilter object to build up a set of custom
    sorts and filters and pass that object into the DB control method.
    There have been other posts here about doing this, look for the subject
    "DatabaseFilter example".
    Hope that helps...
    Eddie
    Dan Hayes wrote:
    "Sathish Venkatesan" <[email protected]> wrote:
    Hi Maruthi,
    The parameter substituion , I guess is used like setting the values for
    prepared
    statements.
    What I'm trying to do , is change the sql at run time based on some condition.
    For example ,
    consider the following query :
    select col1,col2 from table t where t.col3 > 1
    At run time , based on some condition , I need to add one more and condition.
    i.e. select col1,col2 from table t where t.col3 > 1 and t.col4 < 10.
    This MAY not address your issue but if you are trying to add "optional" parameters
    you may try including ALL the possible parameters in the SQL but send in null
    for those params that you don't want to filter on in any particular case. Then,
    if you word your query
    as follows:
    select col1, col2 from table t where t.col3 > 1 and (t.col4 = {col4param} or
    {col4param} is null) and (t.col5 = {col5param} or {col5param} is null) ...
    you will get "dynamic" filters. In other words, col4 and col5 will only be
    filtered if you send in non-null parameters for those arguments.
    I have not tried this in a WL Workshop database control but I've used
    this strategy dozens of times in stored procedures or jdbc prepared statements.
    Good luck,
    Dan

  • Querying PL/SQL function which returns SYS_REFCURSOR

    Hello:
    I have a PL/SQL function with return type of SYS_REFCURSOR.
    In SQLPlus, I can query it either as
    var c refcursor
    exec :c := func(...)
    print c
    or
    select func(...) from dual;
    Running the latter in Eclipse 3.3 with oracle DTP extensions installed gives me OracleResultSetImpl object in the SQL Results view.
    Can the code be a little smarter and recognize that a sql query may return "indirect" resultset?
    Regards,
    Ernest

    This is noted; will be the interface better to handle the return values. Thanks

  • Queries regarding SGA, PGA and parsed SQL Queries

    Hi
    I am new to Oracle server architecture.
    Please correct me if am wrong.
    As per my understanding, the data that we retrieve from a SQL query is stored in SGA in Database buffer cache.
    I have some queries:
    1. Does the database buffer cache store only data from SQL queries or anything else also? What is its size? Can we set the size?
    2. Where are the parsed SQL queries stored - SGA or PGA? And where exactly? I want to know if all the users connected in an Instance have access to each other's parsed SQL queries?
    3. SGA is shared by all users in an Oracle Instance? PGA and UGA are local to a specific user in an instance? Is it correct?
    Thanks
    Abhi

    AB312062 wrote:
    Hi
    I am new to Oracle server architecture.
    Please correct me if am wrong.
    As per my understanding, the data that we retrieve from a SQL query is stored in SGA in Database buffer cache.
    I have some queries:
    1. Does the database buffer cache store only data from SQL queries or anything else also? What is its size? Can we set the size?
    2. Where are the parsed SQL queries stored - SGA or PGA? And where exactly? I want to know if all the users connected in an Instance have access to each other's parsed SQL queries?
    3. SGA is shared by all users in an Oracle Instance? PGA and UGA are local to a specific user in an instance? Is it correct?
    Thanks
    AbhiThe questions you have are all good ones, but require far too much to be explained (properly) in a forum such as this.
    I would highly recommend picking up a book by Tom Kyte and reading through that.
    Cheers,

  • How do I implement an HTTP Get which returns XML into a View Object?

    I've got a 3rd party program which accepts an HTTP GET and returns information via XML. I'd like to take that XML and then populate a View Object.
    The examples given in the manual are only for JavaScript with an AJAX server that I don't have. Here's an example:
    function UpdateNow() {
         var req = new Ajax.Request("qbwc://docontrol/
         UpdateNow?async=true&AppName=WCWebService3", {method:'get',
         onSuccess:processDataOne, onFailure:reportError});
    }I've been to literally dozens of sites trying to answer my question, but I'm just not knowledgeable enough to know where to start. Can someone point me in the right direction?
    Using JDev 11.1.1.6
    Thanks,
    Will

    I guess the basics would be:
    Create a Java class that reads from the URL of the service:
    http://docs.oracle.com/javase/tutorial/networking/urls/readingURL.html
    Then get the XML that you read into the ADF BC VO using the readXML method of the VO.
    Example 18 here: https://blogs.oracle.com/smuenchadf/resource/examples#18

  • Dynamic SQL queries in HTMLDB application

    How can i build a HTMLDB page only for dynamic sql queries like the features in the HTMLDB SQL-workshop.
    I need a SQL interface for some power user running some ad-hoc queries.
    Can i call this page directly from any other HTMLDB application?
    Regards
    Martin

    Hello Martin,
    I am a beginer in APEX but I have the same problem with you. What are your solution for dynamic sql query ? For report a solution is Pl Sql procedure which return a sql query. But for a form ?

  • SQL queries in JDBC log?

    Hi all.
    I am using CMP entity beans on Weblogic 7.0 and would like to see the SQL queries
    which the EJB container is executing. I would think that I should be able to see
    these in the JDBC log file, but all I see there is DB connection logging.
    I've seen discussion in docs and various newsgroups that implies that these queries
    should be logged in the JDBC log. Do I have to change some parameter in order
    to see the SQL queries in the log file?
    Thanks.
    AL

    I'm using Sybase 12.5 with JConnect 4.5. Since I posted my question, I've found
    a suggestion to define weblogic.ejb20.cmp.rdbms.codegen.verbose=true on the java
    command line when I'm booting WLS. I can now see queries (as well as a bunch of
    other stuff) in the stdout of the weblogic server. But I would still like to have
    the queries logged. Of course, I could redirect stdout, etc. But I thought there
    should be another way, esp considering that the is a JDBC log file. Any suggestions
    would be appreciated.
    AL
    Joe Weinstein <[email protected]> wrote:
    >
    >
    AL wrote:
    Hi all.
    I am using CMP entity beans on Weblogic 7.0 and would like to see theSQL queries
    which the EJB container is executing. I would think that I should beable to see
    these in the JDBC log file, but all I see there is DB connection logging.
    I've seen discussion in docs and various newsgroups that implies thatthese queries
    should be logged in the JDBC log. Do I have to change some parameterin order
    to see the SQL queries in the log file?For 7.0 we do not intercept, copy or log application SQL. Typically jdbc
    logging
    is left to the particular JDBC driver being used. Some drivers can be
    very informative
    or even over chatty, while others will log very little. What DBMS and
    driver are you
    using?
    Joe
    Thanks.
    AL

  • Want to write sql queries online

    Hi,
    I want to write and test sql queries online. Because oracle database is too large I do not want to install it on my system. Is there any virtual environment where I can learn sql queries and test without installing it on my local machine?

    SQL Fiddle apparently offers a test bed for various databases including Oracle 11gR2.
    I haven't used it myself but it was highly recommended by SQL Indexing Tutorial | Use The Index, Luke! which is a good SQL performance tutorial.

  • TOP 10 SQL QUERIES

    Hi,
    How can i find the top 10 sql queries which consuming high IO, CPU's. in oracle db.
    I am doing in one way that by using TOP command trying to get PID's then i am getting the sql query by applying the hash value in v$sqlarea.
    Is there any way to get directly high consumed IO and CPU's with out seeing PID's in TOP command.
    Thansk

    hi,
    try something along the lines of
    select c.* from
        (select disk_reads,
                buffer_gets,
                rows_processed,
                executions,
                first_load_time,
                sql_text
           from v$sqlarea
           where parsing_user_id !=0
           order by
              buffer_gets/decode(executions,null,1,0,1,executions) desc ) c
    where rownum < 11;
    select c.* from
        (select disk_reads,
                buffer_gets,
                rows_processed,
                executions,
                first_load_time,
                sql_text
           from v$sqlarea
           order by
              disk_reads/decode(rows_processed,null,1,0,1,rows_processed) desc ) c
    where rownum <11;or even
    --Top 10 by Buffer Gets:
    set linesize 100
    set pagesize 100
    SELECT * FROM
    (SELECT substr(sql_text,1,40) sql,
            buffer_gets, executions, buffer_gets/executions "Gets/Exec",
            hash_value,address
       FROM V$SQLAREA
      WHERE buffer_gets > 10000
    ORDER BY buffer_gets DESC)
    WHERE rownum <= 10
    --Top 10 by Physical Reads:
    set linesize 100
    set pagesize 100
    SELECT * FROM
    (SELECT substr(sql_text,1,40) sql,
            disk_reads, executions, disk_reads/executions "Reads/Exec",
            hash_value,address
       FROM V$SQLAREA
      WHERE disk_reads > 1000
    ORDER BY disk_reads DESC)
    WHERE rownum <= 10
    --Top 10 by Executions:
    set linesize 100
    set pagesize 100
    SELECT * FROM
    (SELECT substr(sql_text,1,40) sql,
            executions, rows_processed, rows_processed/executions "Rows/Exec",
            hash_value,address
       FROM V$SQLAREA
      WHERE executions > 100
    ORDER BY executions DESC)
    WHERE rownum <= 10
    --Top 10 by Parse Calls:
    set linesize 100
    set pagesize 100
    SELECT * FROM
    (SELECT substr(sql_text,1,40) sql,
            parse_calls, executions, hash_value,address
       FROM V$SQLAREA
      WHERE parse_calls > 1000
    ORDER BY parse_calls DESC)
    WHERE rownum <= 10
    --Top 10 by Sharable Memory:
    set linesize 100
    set pagesize 100
    SELECT * FROM
    (SELECT substr(sql_text,1,40) sql,
            sharable_mem, executions, hash_value,address
       FROM V$SQLAREA
      WHERE sharable_mem > 1048576
    ORDER BY sharable_mem DESC)
    WHERE rownum <= 10
    --Top 10 by Version Count:
    set linesize 100
    set pagesize 100
    SELECT * FROM
    (SELECT substr(sql_text,1,40) sql,
            version_count, executions, hash_value,address
       FROM V$SQLAREA
      WHERE version_count > 20
    ORDER BY version_count DESC)
    WHERE rownum <= 10
    ;you may have to play around with the column formatting a little to show the best results
    regards
    Alan
    Edited by: alanm on Dec 22, 2008 4:01 PM

  • SQL queries Learning

    Hello All,
    I am Oracle Financial Functional consultant and now trying to leran the Technical Stuff.
    Right now I would like to learn Oracle Financial SQL queries which is must to do my current role.
    Can some one please guide me to learn the OF SQL queries.
    Your help is much appreciated!
    Ramesh

    That's a very broad question....
    Probably you're better of in the Financials Forum @ Financials
    If you want to know how SQL works in Oracle, then dive into the docs and so some searches:
    http://www.oracle.com/pls/db102/homepage
    http://www.oracle.com/pls/db112/homepage
    and there's always Google ;)

  • Call plsql procedure from ADFBC which returns a value.

    Hi All,
    I want to call one of my SQL Procedures which returns 4 values after execution from my AMImpl file.
    The code snippet on how I am trying to call the procedure is below, but I am in need of how to fetch the return value of the procedure once its executed.
    public void callPlSql(String firstParm, String secondParm) {
    CallableStatement s = this.getDBTransaction().createCallableStatement("BEGIN my_pl_sql_procedure(?, ?); END;", 0);
    try {
    s.setString(1,firstParm);
    s.setString(2,secondParm);
    s.execute;
    } catch (SQLException e) {
    throw new JboException(e);
    any idea how to get hold of the return values from the executed procedure ?
    Thanks
    TK

    after you executed the procedure, you can get the output based on their type and index
    public void callPlSql(String firstParm, String secondParm) {
    CallableStatement s = this.getDBTransaction().createCallableStatement("BEGIN my_pl_sql_procedure(?, ?); END;", 0);
    try {
    s.setString(1,firstParm);
    s.setString(2,secondParm);
    s.execute;
    e.getDate(index of your output);
    e.getInt(index of your output);
    e.getString(index of your output);
    } catch (SQLException e) {
    throw new JboException(e);
    }you can also check this:
    http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvgen.htm#sm0458

  • Difference between Static SQL Query and Dynamic SQL Query.

    Hi,
    Please explain the basic difference between static and dynamic sql queries. Please explain with example.

    Static: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/static.htm
    Dynamic: http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10472/dynamic.htm

  • ORACLE SQL QUERIES  FOR SAP

    Hello All,
    Can any body give me the total SQL queries which will be used in SAP.
    Thanks&Regards,
    Praveen Kondabala

    Hi,
    If you do need that kind of information, then it is easier that you do not use any.
    > Like Oracle DBA
    you only need to read the documentation about
    1) brtools
    2) dbacockpit (I assume you have a fairly recent SAP version)
    you can find the information about this two "things" in
    SAP on Oracle

  • SQL- Query that return only one record

    Hello,
    is it possible to execute a pure SQL-Query which returns only one row although multiple rows are found.
    It is no problem in PL/SQL, but I have no idea if the same is also possible in SQL.
    thanks in advance
    Michael

    Why not? There are 4 records in this table, but only selected one.
    SQL> with t
      2  as
      3  (
      4     select '#%$@#$@$@##$' Addr from dual
      5     union all
      6     select '18 Jalan Scott' from dual
      7     union all
      8     select '18 Lemana St' from dual
      9     union all
    10     select '32-penstation' from dual
    11     union all
    12     select '99999999999' from dual
    13  )
    14  select addr
    15    from t
    16   where rownum =1
    17  /
    ADDR
    #%$@#$@$@##$
    SQL>Cheers
    Sarma.

Maybe you are looking for