How to create an apex session in e.g. SQL*Plus?

I would like to establish an apex session using a tool different from SQL Workshop.
How can I achieve this using e.g. SQL*Plus or SQL Developer?
Is there some document on the internet which addresses this question? I couldn't find it yet.

First and foremost you need to set the Security Group ID (SGID)
begin
APEX_UTIL.SET_SECURITY_GROUP_ID(APEX_UTIL.FIND_SECURITY_GROUP_ID('MY_WORKSPACE'));  -- replace MY_WORKSPACE with yours
end;
then you might need to set an application_id for certain features to work:
select application_id
    into apex_application.g_flow_id
    from apex_applications
   where application_name = 'my_app_name';  -- replace my_app_name with yours
If you need to create a session id, you can get a fresh one with
DECLARE
  VAL NUMBER;
BEGIN
  VAL := APEX_CUSTOM_AUTH.GET_NEXT_SESSION_ID;
END;
Flavio
http://oraclequirks.blogspot.com
http://www.yocoya.com

Similar Messages

  • How to create an APEX 4.1 session?

    Hi,
    I've successfully used the mechanism described by [this thread|https://forums.oracle.com/forums/thread.jspa?threadID=663227] to create an APEX session in release 3.1.
    We've recently been forced to move onto Oracle 11g and APEX 4.1. The session routine no longer appears to work:
    - after setting up the session a call to the create_collection_from_query results in an error stating 'Invalid parsing schema for current workspace Id';
    - the apex_application.g_instance value is changing - post_login changes the value and show loses the value;
    Any ideas?

    Hi Scott
    Bad news. I read several time this thread, but I have not found error in my program ... .
    And I can not see what are really doing APIs of APEX.
    Time is going - so we have make a decision now.
    Probably (as I have no more answers at this forum) - we can not use APEX (as nobody using APEX sessions as I asked),
    as we can not manage its sessions programmatically (too risky).
    Thanks for your answer.
    Andres

  • Anyone created an apex session in a plsql procedure in 4.1

    Hi all,
    Was wondering if anyone has been able to create a procedure that creates an apex session that allows using collections after upgrading to 4.1
    Our procedure which we used for nightly processing worked fine in 4.0.1 is no longer working after upgrading.
    Thanks for any suggestions or help
    Wayne
    We were using:
    htp.init;
    l_cgivar_name(1) := 'REQUEST_PROTOCOL';
    l_cgivar_val(1) := 'HTTP';
    owa.init_cgi_env(
    num_params => 1,
    param_name => l_cgivar_name,
    param_val => l_cgivar_val );
    for c1 in (select workspace_id from apex_applications where application_id = l_application_id) loop
    l_workspace_id := c1.workspace_id;
    dbms_output.put_line('l_workspace_id:'||l_workspace_id);
    end loop;
    wwv_flow_api.set_security_group_id(l_workspace_id);
    apex_application.g_instance := 1;
    apex_application.g_flow_id := l_application_id;
    apex_application.g_flow_step_id := 999;
    wwv_flow_custom_auth_std.post_login(
    p_uname => l_user,
    p_session_id => null,
    p_flow_page => apex_application.g_flow_id||':'||999);
    wwv_flow.show (
    p_flow_id => apex_application.g_flow_id,
    p_flow_step_id => apex_application.g_flow_step_id,
    p_instance => apex_application.g_instance,
    p_request => 'FSP_SHOW_POPUPLOV'
    execute procedure_XXXX (this procedure contains the code to create an apex collection)

    Not for sure how I did it, but the user handle should have been wcoleku.
    Wayne

  • How to create a new session in JSP file

    Usually a child IE window uses same session with parent window. Dose someone know how to create a new session when creating a new IE window by clicking a URL in parent window? The web page is writen by jsp file.

    I am not sure of your question. Are you wanting to have 2 Session objects (one for the parent window and another for the child)?
    A session is usually created once per client and is stored on the server the session id is carried around in a cookie or a URL rewrite so that everytime the user submits a page you will be able to store/access information.
    // this will create a new session object if one doesn't already exist.
    HttpServletRequest.getSession( true );
    Hope this helps

  • How to create a new session by ABAP?

    Good afternoon everyone:
    This is my first question in the forum, can anybody tell me how to create a new session to display report output in a ALV program? Which function or method can used? I'm freshman.
    Thx.
    Edited by: Joshua Lee on Nov 21, 2008 10:04 AM

    Hi Joshua,
    Welcome To SDN.
    I am not clear about your queestion.
    if u r doing an ALV report if u give selection screen inputs if press execute buttom or F8 u wil get the report.
    if u want the out put in the next screen. you can develop the screen in the module pool
    Regards
    Rasheed
    Edited by: Rasheed salman on Nov 21, 2008 10:25 AM

  • Kdebase4-svn: How to create an X-Session?

    I've successfully built kdebase4-svn from AUR in the meantime, but now I'm wondering how to create an X-Session for it. Normally you create a kde4.desktop file which runs /opt/kde4/bin/startkde... But this file (startkde) does not exist in kdebase4-svn.. Can anyone help?
    Thanks

    Maybe something is broken with that kdebase4-svn. If I'm not mistaken, there are 3 individual KDE4 4.1 Beta 1 distributions available for Arch (kdemod's, tanis' and devs'), try one of them.

  • How to login as DBA in oracle 9i from sql plus .

    how to login as DBA in oracle 9i from sql plus . ???

    First you need to check whether your HR schema is still unlocked or not? If it is locked - then you have to unlock it. And, then you can connect the Hr schema.
    But, i'm not sure - why you need system to log into the HR schema?
    Regards.
    Satyaki De.

  • How to represent time format AM/PM  in Oracle SQL Plus

    How do we represent time format (AM/PM) using SQL plus ? I'd like to get 09/01/2002 12:00 AM or 09/01/2002 12:30 PM displayed. Your inputs will help.
    Thanks

    Using either AM or PM will print out AM or PM
    example:
    SELECT to_char(sysdate,'hh24:mi:ss') ctime,
           TO_CHAR(SYSDATE,'hh:mi:ss AM') ctime_AM,
           TO_CHAR(SYSDATE,'hh:mi:ss PM') ctime_PM,
           TO_CHAR(SYSDATE-.1,'hh24:mi:ss') ctime2,
           TO_CHAR(SYSDATE-.1,'hh:mi:ss AM') ctime2_AM,
           TO_CHAR(SYSDATE-.1,'hh:mi:ss PM') ctime2_PM
    from dual
    RESULTS
    CTIME    CTIME_AM    CTIME_PM    CTIME2   CTIME2_AM   CTIME2_PM
    13:01:02 01:01:02 PM 01:01:02 PM 10:37:02 10:37:02 AM 10:37:02 AM

  • How to create an Apex 3.1 a session context programmatically?

    Hi
    I want to do some unit testing on some pl/sql procedures that use apex collections. As I am using PL/SQL Developer and I am not connected to the database via Apex, inevitably they fail with the error "invalid parsing schema for the current workspace ID".
    How can I create programmatically a session in Apex so I can unit test my code? I am sure I have seen code to do it, but cannot find it anywhere.
    Thanks
    Luis

    Scott
    Thanks for the help!
    You say "uncomment the last line if you need to". How do I know if I need to? If the connected user is different from the application parsing schema?
    In any case, the connect user is the same as the app parsing schema, and when I ran it without uncommenting that last line I got the error:
    ORA-20104: create_collection_from_query_b Error:ORA-20001: Invalid parsing schema for current workspace ID
    ORA-06512: at "FLOWS_030100.WWV_FLOW_COLLECTION", line 1223
    Then I uncommented it (I granted execute to the package beforehand) but got the same error.
    As I said, I am connected as the same database user as the application parsing schema, and the application does not require authentication. Where did it go wrong?
    Please see below the code I am using.
    Thanks
    Luis
    declare
      l_workspace_id   number;
      l_application_id number;
      l_user           varchar2(30);
      l_owner          varchar2(30);
      l_cgivar_name    owa.vc_arr;
      l_cgivar_val     owa.vc_arr;
    BEGIN
      htp.init;
      l_cgivar_name(1) := 'REQUEST_PROTOCOL';
      l_cgivar_val(1) := 'HTTP';
      owa.init_cgi_env(num_params => 1, param_name => l_cgivar_name, param_val => l_cgivar_val);
      l_user           := 'ADMIN'; -- authenticated username
      l_application_id := 999; -- application ID
      l_owner          := 'PS'; -- application owner (parsing schema)
      for c1 in (select workspace_id
                 from   apex_applications
                 where  application_id = l_application_id)
      loop
        l_workspace_id := c1.workspace_id;
        dbms_output.put_line('l_workspace_id:' || l_workspace_id);
      end loop;
      wwv_flow_api.set_security_group_id(l_workspace_id);
      apex_application.g_instance     := 1;
      apex_application.g_flow_id      := l_application_id;
      apex_application.g_flow_step_id := 1;
      wwv_flow_custom_auth_std.post_login(p_uname      => l_user,
                                          p_session_id => null,
                                          p_flow_page  => apex_application.g_flow_id || ':' || 1);
      flows_030100.wwv_flow_security.g_parse_as_schema := l_owner;
      -- Call the procedure
      my_pkg.my_proc;    --- ERROR HERE
    end;

  • How to create an apex collection to store and loop through the values

    I couldn't find any simple example to do this
    Apex 4.2
    I need to create an apex collection. I have a query that returns multiple roles for a user. I need to check to see if one of my item values is within the collection but am not sure how to do so. So far I have:
    begin
    APEX_COLLECTION.CREATE_COLLECTION (
    p_collection_name => 'ALL_ROLES');
    select count(granted_role) into count from dba_role_privs where upper(grantee) = upper(:APP_USER);
    end;
    How would I store the query results in the collection?

    Trying to understand your code and a better suggestion:
    declare
    is_viewable boolean;
    v_count number;
    l_query varchar2(2000);
    i_counter number(10) :=1;
    begin
    --l_query := 'select granted_role from dba_role_privs where upper(grantee) = upper(:APP_USER)';
    --why do you need a collection, this is a simple select count(1) question
    APEX_COLLECTION.CREATE_COLLECTION_FROM_QUERY (
    p_collection_name => 'ALL_ROLES',
    p_query => l_query,
    p_generate_md5 => 'YES');
    -- You create a collection, but where are you using it?
    -- select count(granted_role) into count from dba_role_privs where upper(grantee) = upper(:APP_USER);
    -- discard the above code
    -- If you want to see  how many elements in a collection
    -- determine # of elements in a collection
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_collection.htm#CJAFFEAH
    v_count := APEX_COLLECTION.COLLECTION_MEMBER_COUNT ('ALL_ROLES');
    IF :P32_SUBMISSION_DATE IS NOT NULL THEN
      begin
      select count(granted_role) into v_count
         from dba_role_privs
      where upper(grantee) = upper(:APP_USER) and
        granted_role in ('SURVEY_SUID','SURVEY_JOB_SUID');
      exception
      when no_rows_found then
        v_count := 0;
      end;
      if v_count > 0 then
        is_viewable := true;
      else
        is_viewable := false;
      endif;
    else
      is_viewable := false;
    endif;
    return is_viewable;
    end;Thank you,
    Tony Miller
    Ruckersville, VA

  • How to create an IdM session

    I am writing a standalone Java program to login to IdM, then export some objects. However I fail to create a user session. Here is my code and the error I got.
    String host = "http://localhost:8181/idm";
    URL localurl = new URL (host);
    String User = "myconfig";
    EncryptedData ed = new EncryptedData("password");
    I failed in both
    Session mySession = SessionFactory.getSession(host, User,ed);
    And
    RemoteSession mySession = new RemoteSession(localurl, User, ed);
    with error:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/soap/SOAPException

    Hi,
    import com.waveset.session.Session;
    import com.waveset.session.SessionFactory;
    import com.waveset.util.EncryptedData;
    public class Test {
      public static void main(String[] args) throws Exception {
        EncryptedData ed = new EncryptedData("configurator");
        Object o = SessionFactory.getSession("http://localhost:8088/idm/servlet/rpcrouter2","Configurator",ed);
        System.out.println(o);
    }printed
    com.waveset.session.RemoteSession@18f729c
    for me.
    The error you get implies that you do not have soap.jar in the classpath of your custom application. But even if you had the url you are using should point to the rpcrouter2 servlet of your installation.
    The jars i needed to put in the classpath of my testapp
    in order for it to get a session in IDM7 were:
    activation.jar
    idm.jar
    idmclient.jar
    idmcommon.jar
    mail.jar
    soap.jar
    I think that activation, mail and possibly idm.jar should not
    be needed to get a remote session but obviously they are.
    Regards,
    Patrick

  • How to create a crystal Report using C# and SQL Server

    Hi, im new in creating crystal report using SQL Server, and im making a project.. and could someone help me how to connect your .sdf (SQL Server File) from the bin to your crystal report? thanks a lot.. i followed some instructions like this one (https://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?referrer=http://social.msdn.microsoft.com/Forums/vstudio/en-US/48c0dd48-5b23-49da-8601-878f8406125e/how-to-create-a-crystal-report-using-sql-server-visual-c?forum=csharpgeneral)
    but i got an error on the adding of server name and database portion.. thanks a lot in advance

    Hello,
    Crystal Reports are supported on
    http://scn.sap.com/community/crystal-reports.
    Karl
    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book:
    Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

  • How to create a dropdown box in free hand sql??

    Post Author: nalinipers
    CA Forum: Desktop Intelligence Reporting
    Hi every body,I have created a report by using free hand sql. My client wants to create a drop down box in that report.I do not know how to create the drop down box as i know how to create prompts in free hand sql.can you please help me to create the drop down box by using free hand sql. Periyasamy.

    Post Author: jsanzone
    CA Forum: Desktop Intelligence Reporting
    Hi Periyasamy,
    A drop down box is the same as a prompt that you would build when working in Designer.  If you already have the prompt in mind that you want to use and it exists in your universe, then the easiest way to make it work in free hand SQL is to first build your query in the normal fashion that you would for any other report and include that prompt.  Once you've got the objects and filters pretty much set, then capture the SQL, and modify it now as free hand SQL for your own situation.  You will notice that there may be some "@prompt" stuff scattered in your SQL, which will now run as a drop down box when you go to run your free hand SQL.  You can take note of how things were constructed and the next time you have to build your own free hand SQL you can either do it again the way just described, or build it totally on your own.

  • How to create JDBC connection in J2ME with MS-SQL server?

    I need to have database connection in PDA with SQL server,as i am new to J2ME ,i dont know how to create jdbc connection on J2ME device.Please help me out with this problem........

    I need to have database connection in PDA with SQL server,as i am new to J2ME ,i dont know how to create jdbc connection on J2ME device.Please help me out with this problem........

  • How to trace an ApEx page processes(anonymous PL/SQL) submited by any user?

    Dear Friends;
    can I trace an ApEx page processes (anonymous PL/SQL code step by step) submitted by any user?
    could you explain in detail, please?
    regards
    Siya
    Edited by: sak on Feb 3, 2012 1:07 AM

    Hello
    You can get user id using select v('APP_USER') FROM DUAL or simply :APP_USER.
    Zulqarnain
    MaxApex Hosting
    http://www.maxapex.com

Maybe you are looking for

  • Ctrl+tab is not working in editing mode

    I have JcheckBox and JTable in my JPanel. When user clicks or presses F2 to edit any cell value of the JTable a comboBox will appear with possible values. (This comboBox is coming from table CellEditor). When user presses ctrl+tab from the table focu

  • No bootable device message - can I reboot temporarily to retrieve valuable data?

    Hi. Turned on my Presario CQ61-110SA notebook this morning and after a bit of bleeping I'm confronted with the 'No bootable devic - insert boot disk and press any key' message. I went through the various F10 diagnostics, but no joy - the system doesn

  • Premiere Pro CC Multicam - 2 camera angles being split into multiple tracks

    I love CC's multicam feature, but keep having this problem: In Pluraleyes, I would lay all my Cam 1 material on video track 1 (multiple clips), then Cam 2 on video track 2 (multiple clips), add my audio, and create a multicam track that kept all Cam

  • Oracle sga

    when i start the oracle oracle gives me a message after checking the security that: no oracle found. null

  • Xdb.XDB_PITRIG_PKG.pitrig_truncate

    I have this query executing over 35,000 times when our test suits are running on 10.2.0.2 which causes a lot of time and CPU consumption. The same tests (no difference) are running on 10.1.0.4 with no problem for years now. What is new to 10.2 versio