Using APEX_COLLECTION in a DB-Function??

Hello,
in Apex I would call a PL/SQL page process (anonymous block), which invoke a database function (called A).
This db function, A, invokes a further db package via database link on a remote database.
The package on the remote database writes its result in a global temporary table (also located on the remote database).
Now, I would read the result set from the global temporary table in db function A and put it in a APEX_COLLECTION.
But it seems so, that I could only use APEX_COLLECTION directly in an anonymous pl/sql functions over the apex web-interface.
Calling the remote package und querying the remote global temporary table via database link in an anoynmous pl/sql function don´t work correctly.
Sometimes I can´t read any data of the global temporary table. Is it possible, that the database link is closed between calling the remote package and querying the remote table, although the calls happens in the same transaction (anonymous pl/sql function)?
Greetings
Michael

SQL> ed
Wrote file afiedt.buf
  1  WITH tbl AS (SELECT '201aaa' dt FROM DUAL UNION ALL
  2               SELECT '123bbb' dt FROM DUAL UNION ALL
  3               SELECT '567ccc' dt FROM DUAL UNION ALL
  4               SELECT 'ab123ddd' dt FROM DUAL
  5               )
  6  SELECT dt,CASE WHEN dt like '%123%' THEN 'Match'
  7         ELSE 'Not Matched'
  8         END With_case
  9        ,DECODE(REGEXP_SUBSTR(dt,'123'),NULL,'Not Match','Match')   With_Regexp
10        ,DECODE(INSTR(dt,'123'),0,'Not Match','Match') With_Instr
11        ,DECODE(REPLACE(dt,'123'),dt,'Not Match','Match') With_Replace
12* FROM tbl
SQL> /
DT       WITH_CASE   WITH_REGE WITH_INST WITH_REPL
201aaa   Not Matched Not Match Not Match Not Match
123bbb   Match       Match     Match     Match
567ccc   Not Matched Not Match Not Match Not Match
ab123ddd Match       Match     Match     MatchEdited by: Saubhik on Jul 26, 2010 5:24 AM
Edited by: Saubhik on Jul 26, 2010 5:40 AM
Edited by: Saubhik on Jul 26, 2010 5:40 AM

Similar Messages

  • Using apex_collection with apex_plsql_job

    Hi,
    Can anyone help with this?
    I'm building a CSV uploader app that uses apex_collections. A CSV file is uploaded to a blob column I then have a function that is successfully parsing the file and dropping the data into an Apex collection.
    This is working really well but I would like to extend it to handle really large CSV files without crashing the broswer. I would like to call my process using apex_plsql_job.
    I can't get this to work. The process runs but I can't see any data in my collection. It seems that because apex_collections are session specific, running the process of populating one via apex_plsql_job creates a collection in another session so I can't access it.
    So my question is; Is it possible to do one of the following?
    1. create an apex_collection and specifying the session I want to create it in - So I can pass in a session id to my call to apex_plsql_job
    OR
    2. call apex_plsq_job using a specific session so I can synchronise the collection that way.
    OR
    3. Querying an apex_collection specifying the session (presumably by querying the underlying tables and bypassing the apex_collections view)
    Any help appreciated.
    Cheers
    Yog

    Hi Denes,
    I have a follow up question. I hope you can help.
    I've not even managed to get as far as testing your session procedures. When I try to run the below procedure using the following on page call
    see procedure code at bottom
    BEGIN
    *:P1_JOB_ID := APEX_PLSQL_JOB.SUBMIT_PROCESS(*
    p_sql => 'BEGIN extract_file('||:P1_CSV_ID||', '||:APP_SESSION||', '||:APP_USER||', 104, 1); END;',
    p_status => 'Background process submitted');
    END;
    Nothing happens. Querying the apex_plsql_job view tells be that the job has completed.
    select * from APEX_PLSQL_JOBS where job = (select max(job) from apex_plsql_jobs)
    ID                          JOB FLOW_ID OWNER       ENDUSER   CREATED   MODIFIED STATUS                                SYSTEM_STATUS SYSTEM_MODIFIED SECURITY_GROUP_ID
    *2479017510194585 110 - KF_SYSTEM ANDERSON 07-APR-10 07-APR-10 Background process submitted COMPLETE 07-APR-10*
    *940410095919087*
    However, when If run select * from APEX_030200.WWV_FLOW_COLLECTIONS$ there is no collection called "LOADER" against any user
    even if the collection was not created I would have expected my test_log table to have been populated and it is empty.
    I have tried running apex_plsql_job using
    BEGIN
    *:P1_JOB_ID := APEX_PLSQL_JOB.SUBMIT_PROCESS(*
    p_sql => 'BEGIN insert into test_log(val) values (123); END;',
    p_status => 'Background process submitted');
    END;
    and it runs fine and populates my table.
    I've tried running grant execute on extract_file to public with no effect.
    I get the feeling I'm missing something really obvious here...
    Cheers
    Yog
    CREATE OR REPLACE procedure extract_file(p_csv_id IN NUMBER, p_session_id IN NUMBER, p_user IN VARCHAR2, p_app_id IN NUMBER, p_page IN NUMBER) as
    v_blob_data BLOB;
    v_blob_len NUMBER;
    v_position NUMBER;
    v_raw_chunk RAW(10000);
    v_char CHAR(1);
    v_chunk_len NUMBER := 1;
    v_line VARCHAR2 (32767) := NULL;
    v_data_array apex_application_global.vc_arr2;
    v_rows NUMBER;
    v_sr_no NUMBER := 1;
    v_script VARCHAR2(32767);
    v_error VARCHAR2(1000);
    BEGIN
    delete from test_log;
    insert into test_log(val) values ('p_csv_id = '||p_csv_id);
    insert into test_log(val) values ('p_session_id = '|| p_session_id);
    insert into test_log(val) values ('p_user = '||p_user);
    insert into test_log(val) values ('p_app_id = '||p_app_id);
    insert into test_log(val) values ('p_page = '||p_page );
    commit;
    HTMLDB_CUSTOM_AUTH.define_user_session (p_user, p_session_id);
    HTMLDB_APPLICATION.g_flow_id := p_app_id;
    HTMLDB_CUSTOM_AUTH.post_login (p_user,
    p_session_id,
    p_app_id || ':' || p_page
    apex_collection.create_or_truncate_collection( p_collection_name => 'LOADER' );
    SELECT csv_file
    INTO v_blob_data
    FROM test_csv
    WHERE csv_id = p_csv_id;
    v_blob_len := dbms_lob.getlength( v_blob_data );
    v_position := 1;
    WHILE ( v_position <= v_blob_len ) LOOP
    v_raw_chunk := dbms_lob.substr( v_blob_data, v_chunk_len, v_position );
    v_char := chr( fiche.hex_to_decimal( rawtohex( v_raw_chunk ) ) );
    v_line := v_line || v_char;
    v_position := v_position + v_chunk_len;
    IF v_char = chr(10) THEN
    v_line := replace( v_line, ':', '^' );
    v_line := replace( v_line, ',', ':' );
    v_data_array := apex_util.string_to_table( v_line );
    v_script := ' BEGIN
    apex_collection.add_member( p_collection_name => ''LOADER'' ';
    FOR i IN 1..v_data_array.COUNT LOOP
    v_script := v_script || '
    , p_c' ||lpad(i,3,0)|| ' => ''' || replace( replace( replace( to_char( v_data_array(i) ), '^', ':' ), chr(10),'' ), chr(13), '' ) ||'''';
    END LOOP;
    v_script := v_script ||' );
    END;
    execute immediate v_script;
    v_line := NULL;
    v_sr_no := v_sr_no + 1;
    END IF;
    END LOOP;
    exception when others then
    v_error := to_char(SQLERRM);
    insert into test_log(val) values (v_error);
    commit;
    END;
    Edited by: Yog on Apr 7, 2010 2:57 PM

  • How can I use Automator to toggle the Function Keys?

    I am trying to create a Automated process to toggle the Function Keys on my keyboard. This is because I use several programs, including After Effects, which use the F1-12 keys, but when I am not using that program I commonly use the Apple-defined shortcuts on the keyboard. I have a full-sized keyboard, hence no Fn key. So that's out right away – I've read several comments on this topic where people suggested that this is the ONLY option. I refuse to beleive that.
    Automator contains a "Watch Me Do" feature, which I have tried to use to record this process. Problem is, it never clicks the right object. If I record clicking the dock, the magnification (I suspect) throws off the virtual-controlled mouse and picks the wrong object. If I record the Apple Menu route, it gets it about 1/2 the time.
    I think what I'm really looking for is a console command I can feed into the Terminal which toggles the keys. It seems to be that this HAS to be an option, even if it is more than one line of commands. I believe if I can feed this process into Automator, it would work.
    Any ideas?
    Thanks in advance, Mac Geniuses!

    iKey lets you define function keys per application. You seem to want to turn on & off the defined apple keys.  Not sure if these keyboard re-mappers will do the trick.
    Here is my other most favored application. Of course, I haven't checked these out in newer OS's. I'm a Tiger man myself.
    iKey is a front end program that simulates typing and mouse movements. I use iKey to remap the Function keys.
    "iKey is an automation utility, a program that creates shortcuts to accomplish repetitive tasks. In essence, an iKey shortcut is a little program in its own right, but you don't need to know the first thing about programming to create an iKey shortcut. All you have to do is put together three necessary parts of a shortcut: One or more commands that give the shortcut its functionality, a context in which it runs, and a launcher that defines how the shortcut is activated."
    http://www.scriptsoftware.com/ikey/
    iKey  has a little more function then the previous free version called youpi key. For many years, I used youpi key before switching to iKey.  It works fairly well for me in MAC OS 10.4 although not officially supported.  The youpi key download is hard to find & no longer here.
    http://www.versiontracker.com/dyn/moreinfo/macosx/11485&vid=75326
    ( Send me a message for a copy of youpi  key. )
    *Examples:*
    I have the common programs that I use assigned to function keys. I have F4 assigned to Firefox. When I want to start FireFox, I press F4. When I want to switch to firefox, I press F4! Starting & switching to an application in Mac OS are the same thing in Mac OS.
    Here is an example of to assign volumn control to a function key.
    http://discussions.apple.com/message.jspa?messageID=10361085#10361085
    Here is my script for listing my application folder. I have it assigned to function-key 6.
    tell application "Finder"
       open folder "Applications" of startup disk
       select Finder window 1
       set bounds of Finder window 1 to {-3, 44, 691, 545}
       --set position of Finder window 1 to {33, 44}
       set position of Finder window 1 to {60, 45}
       activate
    end tell
    The second portion of this script was generated in the script editor record mode. After I recorded the script and did some editing, I copy the script to ikey/youpi key.
    Full Key Codes
    http://download.cnet.com/Full-Key-Codes/3000-2094_4-44175.html
    Spark
    "Spark is a powerful, and easy Shortcuts manager. With Spark you can create Hot Keys to launch applications and documents, execute AppleScript, command iTunes, and more... You can also export and import your Hot Keys library, or save it in HTML format to print it. Spark is free, so use it without moderation!"
    http://www.versiontracker.com/dyn/moreinfo/macosx/22675
    Mac OS X remap or rename keyboard keys
    by vivek
    So how do you remap or rename keyboard keys under Mac OS X?
    Simply use DoubleCommand software.  It is a free program
    http://theos.in/apple/download-doublecommand-to-remap-keyboard-keys/
    Keyboard Maestro is a powerful macro program for Mac OS X (including Tiger and Leopard) which has received glowing reviews. Keyboard Maestro will take your Macintosh experience to a new level in “Ease of Use”. With Keyboard Maestro you can design a custom action sequence with your own shortcuts and use them at any time, you can navigate through running applications and open windows with Program Switcher, and you can work with an unlimited number of clipboards - all by pressing simple keystrokes.
    http://www.keyboardmaestro.com/main/
    "Spark is a powerful, and easy Shortcuts manager. With Spark you can create Hot Keys to launch applications and documents, execute AppleScript, command iTunes, and more... You can also export and import your Hot Keys library, or save it in HTML format to print it. Spark is free, so use it without moderation"
    http://www.versiontracker.com/dyn/moreinfo/macosx/22675

  • How to use a mysql built-in function with dataprovider

    hi.
    I want to use a mysql built-in function, for example, MD5() on a column when updating a table with dataprovider.
    Something like this doesn't work:
    MyDataProviderOne.setValue("tablename.field_name", "MD5('some text')");
    How should it be done?
    thanks.
    Mike.

    hi.
    thanks. this helped, but I'd like to use also different functions, that's why, I'd rather do it by MySQL built-in functions with dataprovider... Is there any way to do that?
    best regards.
    Mike.

  • Is there a way to use the preview in browser function without an Internet connection?

    This morning our cable modem was down and I was making some changes to a page in a Muse site I'm designing. I wanted to preview the changes in a browser, but when I clicked on the Preview button (or clicked on preview in browser), I received a notification that it was checking for an Internet connection and the preview page never completed. Is there a way to use the preview in browser function in Muse without an Internet connection?

    Thanks for getting back to me! When our cable modem went down, we were still connected to Airport Base Station, and perhaps it appeared to Muse that we did have an Internet connection. In any case, we have now received a new cable modem and our network is working again. As you suggested, I disconnected from the network and tried preview in Muse again, and now it seems to be working just fine. Perhaps it was just the circumstances of our network problem this morning. Good to know I can use the Muse Preview function off-line!

  • How to use database look up table function in xsl mapping

    Can anybody tell me how to use database look up table function while mapping xsl between 2 nodes.
    I have an XML file coming in and depending on one of XML elements we need to decide which further path to take. But, using this XML element, we need to query database table, get metadata and accordingly take appropriate path. I have written lookup function which returns metadata value.
    Now, the issue is how do I pass the XML element valu as input to look up function? When I tried to drag it to the input node of lookup function, it throws an error like "Maximum number of parameters exceeded"
    Thanks,

    If the lookup table is always going to remain the same (e.g. a character generator or something similar) you can place the values in a 2D array constant on your diagram, with the input value as one column, the equivalent as the other. When you need to perform the lookup you use an index array to return all the values in the "input column", search it using "search 1D array" and use the resulting index number to index the other column's data. If the values may change, then it would probably be best to load an array control with your equivalent values from a file.
    P.M.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • Can i  use Two DSO 's in Function module

    hi experts,
    Can i  use Two DSO 's in Function module  .That FM is used for Layout
    I actually  want to  fill one DSO Refering the Data in Another DSO.
    Regard
    Naresh.

    In the first way the DSO's are usually called shared libraries or DSO libraries and named libfoo.so or libfoo.so.1.2. They reside in a system directory (usually /usr/lib) and the link to the executable program is established at build-time by specifying -lfoo to the linker command. In the second way the DSO's are usually called shared objects or DSO files and can be named with an arbitrary extension

  • What is use of Acquisiton value in functional location in PM module?

    Hello,
    what is use of Acquisiton value in functional location in PM module?
    Regards,
    Ram Rathode.

    HI Ram,
    You can  do an F4 to get the description of a field.
    Please go through following for your reference:
    Acquisition Value of an Asset
    Assets table for Acquisition value and Equipment number
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/01/d544ef4ab311d189740000e8322d00/frameset.htm
    http://help.sap.com/erp2005_ehp_05/helpdata/EN/c1/376976449a11d188fe0000e8322f96/frameset.htm
    Please award if useful.
    Thanks,
    Ravi

  • Insert query using fn-bea:execute-sql() function

    Hi ,
    How to use sql insert query in Xquery function fn-bea:execute-sql().
    Could you please anyone help me on this.
    Regards
    Rajesh.

    Hi
    Can i use stored procedure in that function to include insert query?
    could you please suggest me on this.
    Please provide some links or tutorial on that.
    Regards
    Rajesh

  • With using any version of iTunes, whenever I import songs into my library using the "add to library" function, iTunes adds those songs in songs' alphabetical order. This is pretty annoying since it does not preserve the logical track number or album.

    With using any version of iTunes, whenever I import songs into my library using the "add to library" function, iTunes adds those songs in songs' alphabetical order. This is pretty annoying since it does not preserve the logical track number or even the album sort order (for example when adding 2 albums stored in a unique folder). Anyone has any ideas ? Been stumped for a while....!!!

    hi i had the same problem today when i updated my itunes to latest version. however, i have just found my songs in the 'itunes media' folder. this was accessed through 'my music'  then keep clicking through until you find itunes media and all my library songs were in there and i then just added these files to my library and all were restored however, i have lost all my playlists but at least my 700 songs are back. very dissapointed with apple that they have let this happen with their latest update, the previous version was miles better than this one . hope you find them. stevo

  • In the numbers app, using the "date and time" function, is it possible to remove the time? I need to put together a list of dates, but I don't need or want times.

    In the numbers app, using the "date and time" function, is it possible to remove the time? I need to put together a list of dates, but I don't need or want times.

    When formatting your column to date/time, pick Date & time, and then pick the letter i in the circle to the right. Then scroll down and pick "No time"
    Jason

  • Need an example how to use SCAN_Start with a callback function

    I would appreciate if someone helps me with a working example of how to use SCAN_Start with a callback function. I need just a basic functionality: to specify a channel list (with gains probably), to start a data acquisition task and to receive data buffers utilizing a callback function. t this time whatever I was trying to do caused computer hangups, though it is supposed to be one of the most regular tasks to perform.
    Thank you in advance,
    Mike

    Hello Mike,
    Thank you for contacting National Instruments.
    Attached is an example project which uses a callback function to begin analog acquisition (AI) by calling SCAN_Start. This project acquires from the first 2 channels on your DAQ device. Make sure to modify the device number in the code to match the number of your card.
    Let me know if you have any further questions...
    Sincerely,
    Sean C.
    Applcications Engineer
    National Instruments
    Attachments:
    Acquire_multichannel_61xx.zip ‏11 KB

  • What is the difference using start condition and check function module

    what is the difference  between using start condition and check function module

    That's new to me, I thought a start condition was evaluated before the workflow started, and thus now workflow work item is available. That's why I think the only situation in which start conditions/check functions can't be used, is when the availability of a workflow log for investigation of exactly what stopped the workflow is a requirement.
    I suppose the <a href="http://help.sap.com/saphelp_46c/helpdata/en/4c/86bf43feca11d2a64f0060087a79ea/frameset.htm">SAP documentation</a> is in need of an update.

  • Using the result of a function, inside a subselect

    Hi!
    I´m wondering if it´s possible to use the result of a function inside a subselect. Let me give you an example of what I´m trying to do here:
    select * from t_node where node_pk in (get_node_parents_pk(22345));
    The function get_node_parents_pk stands in for the following SELECT-statment:
    select node_pk from t_node_child where parent_node_pk = 12345
    The statement above would return something like this: 12435,23423,23453,23452
    These values represent the node_pk value for the parent nodes.
    I want the get_node_parents_pk function to return a result set similar to this so that I might call it inside the IN ( ) statement.
    Any clue? =)

    I created a collection type in the database:
    CREATE OR REPLACE TYPE nodes_pk_arr IS TABLE OF INTEGER;
    The function get_node_parents_pk () is made to return the collection type above. However, this does not work. I get the following error message:
    SELECT *
    FROM t_node
    WHERE node_pk IN
    (SELECT * FROM TABLE (get_node_parents_pk (22345)));
    ORA-22905: cannot access rows from a non-nested table item
    However, if I insert a nodes_pk_arr collection directly into the SQL-statement, like I do below, it works:
    SELECT *
    FROM t_node
    WHERE node_pk IN
    (SELECT * FROM TABLE (nodes_pk_arr(24564,23545,34523));
    So, when returning the collection from the function I´m told that the collection is not a nested table, when in fact it is. What gives?
    Also, is there no way to return a result set directly from the get_node_parents_pk() function, making it possible to write the statement like that shown below?
    SELECT *
    FROM t_node
    WHERE node_pk IN (get_node_parents_pk (22345));
    Your reply is much appreciated!
    Kind regards
    Robert

  • Using utl_encode.base64_encode within decode function

    Hi, I want to use utl_encode.base64_encode within decode function. However, the result is not as expected.
    select 'a', decode('a', '1', 'EQUAL to 1',
    --'NOT EQUAL to 1'
    utl_encode.base64_encode('a')
    ) result
    from dual
    A     RESULT
    a     43673D3D
    43673D3D is not a base64 encoded value of a
    What is wrong with the sql?
    Thanks

    SQL> select 'a'
      2  ,      utl_encode.base64_encode(utl_raw.cast_to_raw('a')) raw_result
      3  ,      utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw('a'))) string_result
      4  from   dual;
    ' RAW_RESULT      STRING_RESULT
    a 59513D3D        YQ==
    1 row selected.Keep in mind that utl_encode.base64_encode returns a RAW and needs RAW input.
    You'll probably need UTL_RAW to get your desired result.
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_encode.htm#CACECFHF

Maybe you are looking for

  • Capture Excise Invoice for STO - J1IS

    Dear All, I have created 2 plants. i am doing STO between them, i have not created related Vendor and Customer against the plants as i am creating STO without SD. I am able to issue goods (351 Movement type) from supplying plant to recieving Plant. N

  • Questions in relation to iPod nano

    Hi, I have a few questions in relation the 5th generation iPod nano and I was hoping to find answers to them here. *Voice Memo* 1. Are there any limitations imposed on the nano's voice memo functionality? For instance, does the nano record up to a pr

  • Questions on setting up a portal using oracle

    hi, i want to use oracle to set up a portal which is open to public and each user can register to setup their own account (with their own userid & password) and store their profile. At the same time, my application will periodically perform some task

  • Hide Calendar in ESS Web Dynpro Time Entry Application

    Hello All, We are currently on ESS SP 11. NW 2004 SP19 (EP 6.0 SP 19) In "Record Working Time" application, we see the Calendar expanded by default. We want to Hide the Calendar by default. I have went the link /thread/82037 [original link is broken]

  • Embeding Flash Video on other websites

    I would like to be able to share some of our website videos with other websites. The idea is the same as Google Videos which allows a user to cut a snippet of code and paste that into their own webpage. The result is a Flash video 'playing' on the en