Apex_util.is_login_password_valid

Hi,
Just a quick gripe in the concern that I haven't fully understood the problem and
someone can add their feedback please:
I'm following the custom authentication recipe around page 74 of the Pro Oracle Application Express
book.
There is an example there of calling the "is_login_password_valid" function.
Having tried this and found it failing, I think I've found the cause of the problem.
The first argument to this function MUST be in upper case for the function to have any chance
of succeeding.
The book does allude to this issue, but only quite a few pages later.
The documentation on the Oracle site has an example using upper case but I didn't read any
words that stated this requirement.
Admitting to my own fallibility, have I got this wrong folks?
Feedback please.
Thanks in advance
Mungo
Edited by: MungoHenning on Feb 11, 2010 12:30 AM

its a validation that runs when the user clicks on the submit button the validation type is function returning Boolean. There is a condition set to
when button : submit is pressed and that expression 1 is not null. in expression 1 I have placed put Text item which the user would have entered in their old password.
Like I said it works perfectly in 1 workspace. I moved it to two other spaces and both of them did not work it would just accept any value.

Similar Messages

  • Function to validate APEX password entered after login within an app.

    Hi Folks.
    I have a requirement that, one or two functions in my app require a password to be entered.
    What I'd like to do is provide the user a password field where they enter their APEX password and I can then call a function to validate the password entered against the user's APEX password.
    I know, if they have logged in then they have already entered their password! But this is to cater for the 'unattended' PC scenario where a malicious user if trying to impersonate a restricted user.
    I'd like a simple way of incorporating APEX password validation from within the application on an ad-hoc basis for security sensitive tasks/actions.
    If anyone has any suggestions, I'd be most grateful.
    Many thanks.
    Simon.

    Simon,
    Use apex_util.is_login_password_valid.
    function is_login_password_valid (
       -- Checks the wwv_flow_fnd_users table to see if
       -- username/password combo is valid within the current workspace (checking by security_group_id)
       p_username in varchar2 default null,
       p_password  in varchar2 default null)
       return boolean
       ;Scott

  • Howto use two Authentification Schemes at once?

    I'm still new to certain Apex aspects. At the moment I'm struggeling with the implementation of different Authentification algorithms.
    I currently have a small APEX application that does the user authentification by LDAP (AD). However I want to add a few special users (GUEST, ADMIN, etc.) that are not in the active directory/LDAP but that exists as "normal" APEX user.
    Question is: How can I use two different Authentification schemas for one application at the same time?
    So that a user with a valid windows login is authenficated by its windows username/pwd
    and a guest user who is not in the LDAP but is configured as APEX user will be authorized too.
    The order of the different authorization schemas might also play a certain role here.
    Any hints/links how to achieve this are very welcome.
    Edited by: Sven W. on Nov 6, 2009 12:49 PM: Changed Autorization to Authentification

    Together with a fellow collegue we created a database function that checks for the application, fetches the current authentication schema and uses the LDAP information from there. It is not perfect, but serves our purpose well. Feel free to reuse or comment on it.
    create or replace package body SYN_UTIL
    as
        FUNCTION apex_ldap_authenticate (
          p_username in varchar2,
          p_password in varchar2
        ) return boolean as
          v_login_result  boolean := false;
          v_ldap          raw(32);
          v_ldapres       binary_integer;
          v_un            varchar2(100);
          v_ldap_port     varchar2(100);
          v_ldap_host     varchar2(100);
          v_app_id        integer;
        BEGIN
           -- test for empty variables
             if p_username is null then
                   raise_application_error(-20001, 'Please insert Username and Password!');
             end if;
             if p_password is null then
                   raise_application_error(-20001, 'Please insert Username and Password!');
             end if;
             -- check for APEX-workspace-users
            if  not v_login_result then
              if APEX_UTIL.IS_LOGIN_PASSWORD_VALID(
                P_USERNAME => p_username,
                P_PASSWORD => p_password
              ) then v_login_result := true;
              end if;
            end if;
            if not v_login_result then
              -- LDAP-Login
              dbms_ldap.use_exception :=true;
              -- get application-id    
              v_app_id := NV('APP_ID');
              -- get LDAP information from views     
              select auth.ldap_host, auth.ldap_port, auth.ldap_dn_string
              into v_ldap_host,v_ldap_port,v_un
              from APEX_APPLICATIONS ap
              join apex_application_auth auth on ap.application_id = auth.application_id
                  and ap.AUTHENTICATION_SCHEME = auth.AUTHENTICATION_SCHEME_NAME -- current authentication
              where ap.application_id =  v_app_id;
              -- LDAP init
              v_ldap := DBMS_LDAP.INIT(
                HOSTNAME => v_ldap_host
               ,PORTNUM  => v_ldap_port
              -- extract domain from v_un and add p_username
              v_un := replace(v_un,'%LDAP_USER%',p_username);
              -- connect to LDAP-server
               begin   
                v_ldapres := DBMS_LDAP.SIMPLE_BIND_S(
                    LD     => v_ldap,
                    DN     => v_un,
                    PASSWD => p_password
               exception
                -- only handle defined exceptions
                when others then
                     v_login_result := false;
               end;
               -- disconnect from LDAP
               v_ldapres := DBMS_LDAP.UNBIND_S(LD => v_ldap);
               v_login_result := true;
            end if;  -- not v_login_result
          return v_login_result;
        END;
    end SYN_UTIL;THis function is put where usually the default LDAP logic is used.
    In the field Authentication Function instead of -LDAP- this function is called.
    return syn_util.apex_ldap_authenticate; A minor point still is that any entry in "LDAP Username Edit Function" is not considered.
    But since we don't use that currenty we didn't made the effort to integrate it.
    Edited by: Sven W. on Nov 10, 2009 3:20 PM

  • SSO with Apex 4.1.1.00.23

    Hello Apex community,
    i want to implement a SSO solution between an apex and non-apex application. This solution worked with Apex 4.0 but seems not to work with current 4.1.1.00.23.
    I've set up a test case on hosted environment.
    Dev User:
    Workspace: authtest
    User: authtest
    Pass: authtest
    End User:
    User: test
    Pass: test1
    Things i've done:
    (1) Created a custom authentication scheme (marked as current) "auth_scheme" with following authentication function:
    create or replace FUNCTION auth_function(
          p_username IN VARCHAR2,
          p_password IN VARCHAR2)
        RETURN BOOLEAN
      AS
        v_is_authenticated BOOLEAN := false;
      BEGIN
          IF lower(p_username)= 'test' OR APEX_UTIL.IS_LOGIN_PASSWORD_VALID(p_username => p_username,
                                                                            p_password => p_password)
        THEN
          v_is_authenticated := true;
        ELSE
          v_is_authenticated := false;
        END IF;
        RETURN v_is_authenticated;
      END auth_function;(2) Created an "On Load - Before Header" process with sequence 5 on page 101:
    DECLARE
      v_user                VARCHAR2(4000);
      v_pass                VARCHAR2(4000);
      v_fsp_after_login_url VARCHAR2(4000) := :FSP_AFTER_LOGIN_URL;
    BEGIN
      SELECT SUBSTR(v_fsp_after_login_url, instr(v_fsp_after_login_url, 'P101_UNAME') + LENGTH('P101_UNAME') + 1)
      INTO v_user
      FROM dual;
      wwv_flow_custom_auth_std.login(
        P_UNAME       => v_user,
        P_PASSWORD    => v_pass,
        P_SESSION_ID  => v('APP_SESSION'),
        P_FLOW_PAGE   => :APP_ID||':1'
    END;Process condition: request = AUTOLOGON:
    (3) Created a hidden item "P101_UNAME" on page 101.
    (4) Expected behaviour: user loads following URL:
    http://apex.oracle.com/pls/apex/f?p=30964:1::AUTOLOGON:YES::P101_UNAME:testuser schould be logged in without typing in his credentials.
    What happens: user faces login page. What I don't understand: setting process condition to "none", autologon works. But if you have a look into debug report, apex recognizes the request "AUTOLOGON" even if autologon doesn't work. On my dev environment with Apex 4.1.1.00.23 changing process condition doesn't help.
    I can't figure out what I'm doing wrong. With the patchset 4.1.1 there were certain changes concerning FSP_AFTER_LOGIN_URL Re: Deep Link (FSP_AFTER_LOGIN_URL) Not Working in APEX 4.1 I would appreciate any hint.
    Thank you very much for your answers.
    Kind regards,
    Anton
    Edit: Any ideas? I would appreciate any hint.
    Edit2: Any hints maybe? Explicitly setting the FSP_AFTER_LOGIN_URL in the Url doesn't help either...
    Edited by: anton on 20.08.2012 01:26

    Hi Anton,
    that's why I added the IF statement around the code block, to guarantee that it only runs if the URL contains auto-login data (i.e. P101_UNAME). Setting FSP_AFTER_LOGIN_URL to null avoids a loop when the login fails. If we keep FSP_AFTER_LOGIN_URL, the wwv_flow_custom_auth_std.login procedure will redirect to page 101 and the before header process will run again, re-executing wwv_flow_custom_auth_std.login , etc.
    It might be clearer to put the before header code into the authentication itself. The invalid session procedure is the right place for that, but it's use is very sparsely documented yet.
    I created a 2nd copy of your original application (22274), where I removed the before header process and added this invalid session procedure:
    procedure autologon_on_invalid_session
    is
      v_user                VARCHAR2(4000);
      v_pass                VARCHAR2(4000);
      v_fsp_after_login_url VARCHAR2(4000) := :FSP_AFTER_LOGIN_URL;
      v_user_pos            pls_integer    := instr(v_fsp_after_login_url, 'P101_UNAME:');
    BEGIN
      if apex_application.g_flow_step_id != 101 and v_user_pos > 0 then
        v_user := substr(v_fsp_after_login_url, v_user_pos+11);
        wwv_flow_custom_auth_std.login(
            P_UNAME       => v_user,
            P_PASSWORD    => v_pass,
            P_SESSION_ID  => v('APP_SESSION'),
            P_FLOW_PAGE   => :APP_ID||':1' );
        apex_application.stop_apex_engine;
      end if;
    END;If the current page is not 101 (the login page) and the URL (which was copied into the deep link item) contains the autologin credentials, call login. The finall call to apex_application.stop_apex_engine stops Apex from continuing it's default invalid session handling, which is to redirect to the login page.
    Regards,
    Christian

  • APEX_UTIL.PREPARE_URL does not work across workspaces?

    We are running ApEx 4.1.1 on Oracle 11g.
    I am trying to call an application in another workspace and am using APEX_UTIL.PREPARE_URL in a hidden item and then a button with REDIRECT TO URL using javascript:popUp2 which uses the hidden item (the returned value of the PREPARE_URL. The code works fine if I am in the same workspace and a checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:1400894538262901::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:9001,FRD_MASTER_BANSECR&c=STU_WS&cs=3190FB9A8CC967E5B3CED03460DF6F291
    I can press the button and app 9002 opens in a new window.
    When I try the same code in an application in another workspace, no checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS
    and I get the error:
    Error     Session state protection violation: This may be caused by manual alteration of a URL containing a checksum or by using a link with an incorrect or missing checksum.
    I have also tried it without the workspace '&c=STU_WS' and explicitly passing the parameters, but no checksum is returned.
    APEX_UTIL.PREPARE_URL(p_url => 'f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.',p_checksum_type => 'SESSION')
    If I do not try to pass any parameters, no checksum is produced, but the button successfully opens app 9002 in a new window:
    APEX_UTIL.PREPARE_URL('f?p=9002:4:&SESSION.::NO::&c=STU_WS','SESSION');
    returns:
    f?p=9002:4:8288147979401::NO:::&c=STU_WS
    Again, the above code successfully opens app 9002 in a new window. In fact, when not passing parameters to app 9002, I would not seem to need to use PREPARE_URL.
    BUT. I do need to pass the calling app id and the calling app name to app 9002, because 9002 looks up information about the calling app. Since, I must pass parameters, I must use PREPARE_URL, and it does not seem to work when you call it for an app in a different workspace.
    Given all of the above, I have found a kludge. I call PREPARE_URL using the APP_ID of the current app and then replace that APP_ID with 9002.
    replace(APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION'),
    'f?p=&APP_ID.:2','f?p=9002:2')
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS&cs=33B2BB2ECFE3555198CE3325CCF9F67B8
    And the button opens app 9002 just fine.
    Is there anyway to get PREPARE_URL to work with apps in another workspace? What am I missing? Is there a better way than the kludge I came up with?
    A little more information: my app 9002 is a help & info for ApEx DBAs and Developers. It is my attempt at code reuse. Calls to 9002 are in a master template. I can continually update and change the help in 9002 without having to update the apps that call it.
    Thanks for your help,
    Chris

    lewisc3 wrote:
    We are running ApEx 4.1.1 on Oracle 11g.
    I am trying to call an application in another workspace and am using APEX_UTIL.PREPARE_URL in a hidden item and then a button with REDIRECT TO URL using javascript:popUp2 which uses the hidden item (the returned value of the PREPARE_URL. The code works fine if I am in the same workspace and a checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:1400894538262901::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:9001,FRD_MASTER_BANSECR&c=STU_WS&cs=3190FB9A8CC967E5B3CED03460DF6F291
    I can press the button and app 9002 opens in a new window.
    When I try the same code in an application in another workspace, no checksum is returned:
    APEX_UTIL.PREPARE_URL('f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION');
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS
    and I get the error:
    Error     Session state protection violation: This may be caused by manual alteration of a URL containing a checksum or by using a link with an incorrect or missing checksum.
    I have also tried it without the workspace '&c=STU_WS' and explicitly passing the parameters, but no checksum is returned.
    APEX_UTIL.PREPARE_URL(p_url => 'f?p=9002:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.',p_checksum_type => 'SESSION')
    If I do not try to pass any parameters, no checksum is produced, but the button successfully opens app 9002 in a new window:
    APEX_UTIL.PREPARE_URL('f?p=9002:4:&SESSION.::NO::&c=STU_WS','SESSION');This is wrong because you are passing string SESSION for url_charset parameter, that's why id is not adding any checksum
    See this http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_util.htm#AEAPI160
    returns:
    f?p=9002:4:8288147979401::NO:::&c=STU_WS
    Again, the above code successfully opens app 9002 in a new window. In fact, when not passing parameters to app 9002, I would not seem to need to use PREPARE_URL.
    BUT. I do need to pass the calling app id and the calling app name to app 9002, because 9002 looks up information about the calling app. Since, I must pass parameters, I must use PREPARE_URL, and it does not seem to work when you call it for an app in a different workspace.
    Given all of the above, I have found a kludge. I call PREPARE_URL using the APP_ID of the current app and then replace that APP_ID with 9002.
    replace(APEX_UTIL.PREPARE_URL('f?p=&APP_ID.:2:&SESSION.::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:&APP_ID.,&G_APP_NAME.&c=STU_WS','SESSION'),
    'f?p=&APP_ID.:2','f?p=9002:2')
    returns:
    f?p=9002:2:8288147979401::NO::P2_CALLING_APP_ID,P2_CALLING_APP_NAME:112,Testing_Template&c=STU_WS&cs=33B2BB2ECFE3555198CE3325CCF9F67B8
    And the button opens app 9002 just fine.
    Is there anyway to get PREPARE_URL to work with apps in another workspace? What am I missing? Is there a better way than the kludge I came up with?
    A little more information: my app 9002 is a help & info for ApEx DBAs and Developers. It is my attempt at code reuse. Calls to 9002 are in a master template. I can continually update and change the help in 9002 without having to update the apps that call it.
    Review all above API calls and make sure you pass right parameters

  • APEX_UTIL.EDIT_USER Procedure do not work correctly in APEX 4.0.2.00.07

    Hi,
    I created user in Apex system without privileges.
    Next I want to provision privileges using APEX_UTIL.EDIT_USER Procedure.
    But when I try to set p_developer_roles param to ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL in web interface of apex I see the next values: User is workspace administrator - yes; User is a developer - yes; other privilege attributes are NO! When I login I can access to Application Builder but not to SQL Workshop.
    In short if i try to provision any developers privileges changes not appearing in web interface, but also i can access to Application Builder if I have that privilege. When I provision SQL:MONITOR:DATA_LOADER privilege I also see:
    User is workspace administrator - no; User is a developer - yes; other privilege attributes are NO and I can't access to SQL Workshop!
    APEX_UTIL.CREATE_USER Procedure with same values for p_developer_privs param work fine...
    Help me to resolve this issue.

    Please, help

  • Making apex_util.get_print_document return an error message

    We are using apex_util.get_print_document in a process to run a report something like this:
    declare
       l_report blob := null;
    begin
        l_report := apex_util.get_print_document (
            p_application_id      => :APP_ID,
            p_report_query_name   => 'report_query_name',
            p_report_layout_name  => 'report_layout_name',
            p_report_layout_type  => 'rtf',
            p_document_format     => 'rtf'
       if l_report is not null and dbms_lob.getlength(l_report) > 0 then
          apex_application.g_print_success_message := 'Report Created.<br>';       
          INSERT INTO reports (attachment, date_created, filename, mime_type)
          VALUES (l_report, sysdate, 'report.rtf', 'text/rtf' );       
       else       
          apex_application.g_print_success_message := '<span style="color:#CC0000">There was a problem creating the report.</span><br>';   
       end if; 
    end;And this works well most of the time. The problem is, if the report fails for some reason, apex_util.get_print_document gives no information whatsoever as to what went wrong. Is there any way at all we can find out what the problem was?
    Application Express 4.0.2.00.07
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    Hi,
    add exception to your code.
    declare
       l_report blob := null;
    begin
        l_report := apex_util.get_print_document (
            p_application_id      => :APP_ID,
            p_report_query_name   => 'report_query_name',
            p_report_layout_name  => 'report_layout_name',
            p_report_layout_type  => 'rtf',
            p_document_format     => 'rtf'
       if l_report is not null and dbms_lob.getlength(l_report) > 0 then
          apex_application.g_print_success_message := 'Report Created.<br>';       
          INSERT INTO reports (attachment, date_created, filename, mime_type)
          VALUES (l_report, sysdate, 'report.rtf', 'text/rtf' );       
       else       
          apex_application.g_print_success_message := '<span style="color:#CC0000">There was a problem creating the report.</span><br>';   
       end if; 
    EXCEPTION
       WHEN OTHERS THEN
          raise_application_error(-20001,'An error was encountered - '||SQLCODE||' -ERROR- '||SQLERRM);
    end;This will give proper error message.
    Hope this will helps you.
    Regards,
    Jitendra

  • APEX_UTIL.GET_PRINT_DOCUMENT Error Unable to get the document

    Hi,
       I am working on Oracle APEX 4.1 to send the report as an attachment through mail  I am unable to get the document while calling the APEX_UTIL.get_print_document. I have created a report query and report template (rtf template) so as to send the report as an email attachment. The report works fine individually upon clicking of button so there is no issue in BI publisher configuration. I am sure there is something very trivial which I am missing out here. Any help will be appreciated.
    Declare
       l_id number;
       l_document BLOB;
       l_error_msg varchar2(2000);
    BEGIN
       l_document := APEX_UTIL.GET_PRINT_DOCUMENT
             p_application_id=>'123',
             p_report_query_name=>'Sample_Report',   
             p_report_layout_name=> 'Sample_Report',
             p_report_layout_type=>'RTF',
             p_document_format=>'PDF',
             p_print_server => 'f?p=&APP_ID.:0:&SESSION.:PRINT_REPORT=Sample_Report'
       IF l_document is null
       THEN
           dbms_output.put_line( ' no report returned');
          l_error_msg:='<html> <body> <h1 > Apologies the report was not returned from the apex , as there is some printing issues </h1> </body> </html> ';
       ELSE
          l_error_msg:=null;
       END IF;
       IF l_error_msg IS NULL THEN
           l_id := APEX_MAIL.SEND(
           p_to => '[email protected]',
           p_from => '[email protected]',
           p_subj => 'APEX_MAIL with attachment',
           p_body => 'Please review the attachment.',
           p_body_html => '<b>Please</b> review the attachment' || l_error_msg);
          dbms_output.put_line(l_id);
          IF l_document is not null then
             APEX_MAIL.ADD_ATTACHMENT (
                        p_mail_id => l_id,
                        p_attachment => l_document,
                        p_filename => 'Sample_Report.pdf',
                        p_mime_type => 'application/pdf');
          END IF;
    END IF;
    END;
    Here the output says no report returned.
    Thanks & Regards
    Ahmed

    Try removing the parameter p_print_server from the call.  This will use your default print server which should already be configured to use the BI Publisher engine.

  • Apex_util.get_blob was not found on this server

    Hi All,
    APEX Version: 3.1.1.00.09
    Database version 11g
    I am trying to create a report, with a column having a link to download the file stored as BLOB type in the database.
    I performed the following steps:
    *1. created custom report base on SQL Query:*
    select PROGRAM_ID ,
    USER_ID ,
    dbms_lob.getlength(FILE_CONTENT) "FILE_CONTENT" ,
    File_name
    from PGMRECRT_FRMS_USRSUBMTSTATUS
    [Primary Keys for the table PGMRECRT_FRMS_USRSUBMTSTATUS are :  Program_id and user_id]
    *2. Configured BLOB Download Format Mask for the column "File_Content" as:*
    DOWNLOAD:PGMRECRT_FRMS_USRSUBMTSTATUS:FILE_CONTENT:PROGRAM_ID:USER_ID::FILE_NAME:LST_UPD_TSTMP::attachment:Download
    *3. When I run the report I get the Download link in the "File_Content" column.*
    *4. When the link is clicked it throws 404 Not found Error, with the following message on the browser:*
    The requested URL /pls/apex/apex_util.get_blob was not found on this server.
    The Page Source contains the following
    href="apex_util.get_blob?s=3261371303066053&a=101&c=2878703203169482&p=16&k1=147&k2=&ck=01786319873F8A6F1A1344A1B2A17567&rt=CR" alt="Download" title="Download 32KB"
    I don't see the second Primary key being passed in the source. (User_id)
    I checked the HTTP Server error log, here is the error recorded in the log file:
    [Sat Jun  6 02:22:14 2009] [error] [client 141.144.160.57] [ecid: 1244280134:148.87.1.123:18724:0:2223,0] mod_plsql: /pls/apex/apex_util.get_blob HTTP-404 ORA-00900: invalid SQL statement\nORA-06512: at "SYS.WWV_DBMS_SQL", line 206\nORA-06512: at "FLOWS_030100.WWV_FLOW_DML", line 2409\nORA-06512: at "FLOWS_030100.HTMLDB_UTIL", line 1580\nORA-06512: at line 31\n
    Please suggest what is the problem here and how should I go about resolving it.
    I have created sample report: Visit following link: [It is SSO enabled]
    https://techbpo-stage.oracle.com:4443/pls/apex/f?p=101:16
    Thanks & Regards
    Pooja

    For people who are still searching for a solution:
    I think you have to make sure that you select the primary key of the table containing the blob and do not use an alias for this column.
    I first tried following scenario:
    select my_table.pk_id, my_table.description, dbms_lob.getlength(doc.document_data) document_data
    from table1 my_table
    join table2 doc
    on doc.pk_id = my_table.fk_doc_id;
    I filled in the correct column attributes but still this resulted in the 500 error.
    After some research i tried following scenario:
    select my_table.pk_id, my_table.description, doc.pk_id document_id, dbms_lob.getlength(doc.document_data) document_data
    from table1 my_table
    join table2 doc
    on doc.pk_id = my_table.fk_doc_id;
    But still this resulted in the 500 error.
    Finally thanks to a lucky guess I removed the alias from the doc.pk_id and added an alias for the my_table.pk_id and everything worked fine.
    select my_table.pk_id table_id, my_table.description, doc.pk_id, dbms_lob.getlength(doc.document_data) document_data
    from table1 my_table
    join table2 doc
    on doc.pk_id = my_table.fk_doc_id;
    I also read something about the order in which you select the blob file, I always select it as the last column. I'm not sure if this has any influence on the result.
    Regards,
    Bjorn

  • Apex_util.prepare_url from PL/SQL (outside APEX)

    Hello there,
    I have to create a job that sends emails with a link to a page with SSP actived and that requires authentification.
    I've read those threads from Dan and Omar and I wonder if this is still possible in APEX 4.2.1?
    Re: apex_util.prepare_url outside of ApEx
    Create APEX session context from outside APEX (plsql)
    My procedure generate the link with the checksum, but when I try to access the page I got an error :
    •is_internal_error: true
    •apex_error_code: APEX.SESSION_STATE.SSP_VIOLATION2_FOR_DEVELOPERS
    •error_backtrace: ----- PL/SQL Call Stack -----
      object      line  object
      handle    number  name
    0x69e9c2e8       548  package body APEX_040200.WWV_FLOW_ERROR
    0x69e9c2e8       599  package body APEX_040200.WWV_FLOW_ERROR
    0x69e9c2e8       903  package body APEX_040200.WWV_FLOW_ERROR
    0x6e5ff258      6025  package body APEX_040200.WWV_FLOW
    0x73cbd318       249  procedure APEX_040200.F
    0x6bdb2dd0        31  anonymous blockHere is my proc (code found in Omar's thread).
    Maybe I'm missing something.
    CREATE OR REPLACE procedure testInitApexFromOutside
          ( i_app_id     in number
          , i_page_id      in number
          , i_apex_user    in varchar2
          ) is
        v_cgivar_name  owa.vc_arr;
        v_cgivar_val   owa.vc_arr;
        v_workspace_id NUMBER;
        v_app_id       number;
          BEGIN
        -- set up cgi environment
        htp.init;
        v_cgivar_name(1) := 'REQUEST_PROTOCOL';
        v_cgivar_val(1)  := 'HTTP';
        owa.init_cgi_env
          ( num_params => v_cgivar_name.count
          , param_name => v_cgivar_name
          , param_val  => v_cgivar_val
        -- load apex IDs by application name
        SELECT workspace_id,
               application_id
        INTO v_workspace_id,
             v_app_id
        FROM apex_applications
        WHERE application_id=i_app_id;
        -- set up apex workspace
        wwv_flow_api.set_security_group_id(v_workspace_id);
        -- set up apex session vars
         apex_application.g_instance     := wwv_flow_custom_auth.get_next_session_id;
        apex_application.g_flow_id      := v_app_id;
        apex_application.g_flow_step_id := i_page_id;
        -- "login"
        apex_custom_auth.define_user_session
          ( p_user       => i_apex_user
          , p_session_id => apex_application.g_instance
        wwv_flow_custom_auth_std.post_login
          ( p_uname      => i_apex_user
          , p_session_id => apex_application.g_instance
          , p_flow_page  => apex_application.g_flow_id
                         || ':'
                         || apex_application.g_flow_step_id
          -- set array of protected page IDs for session state protection
         apex_application.g_protected_page_ids(1) := '1500';    -- this establishes page 1500 as an SSP-protected page
        dbms_output.put_line(APEX_UTIL.PREPARE_URL('f?p='||i_app_id||':'||i_page_id||':::NO:1500:P1500_PEV_SEQ_NO:18137',2));
    end testInitApexFromOutside;And the result:
    f?p=128:1500:::NO:1500:P1500_PEV_SEQ_NO:18137&cs=3B3D5905A7DDBCB5520E8F88885169CAC
    Thanks for your help,
    Lucien

    See Re: Link in report ?
    Maarten

  • APEX_UTIL.GET_PRINT_DOCUMENT always returning empty BLOB

    Dear community,
    I have a huge problem when using the function APEX_UTIL.GET_PRINT_DOCUMENT in a job or database procedure.
    The following code runs perfectly when I integrate it in the APEX application directly e.g. using a button to execute it (of course I use an anonymous PL/SQL block in APEX itself). But when I run the same code as a procedure or job in the APEX database itself I always receive a mail with an empty PDF:
    CREATE OR REPLACE PROCEDURE APEX_DRUG_SAFETY.CALL_MAIL
    is
    l_id number;
    l_document BLOB;
    BEGIN
    wwv_flow_api.set_security_group_id;
    l_document := APEX_UTIL.GET_PRINT_DOCUMENT
    +(+
    p_application_id=>'105',
    p_report_query_name=>'TestReport',
    p_report_layout_type=>'pdf',
    p_document_format=>'pdf'
    +);+
    l_id := APEX_MAIL.SEND
    +(+
    p_to        => '[email protected]',
    p_from      => '[email protected]',
    p_subj      => 'sending PDF via print API',
    p_body      => 'Please review the attachment.',
    p_body_html => 'Please review the attachment.'
    +);+
    APEX_MAIL.ADD_ATTACHMENT
    +(+
    p_mail_id    => l_id,
    p_attachment => l_document,
    p_filename   => 'mydocument.pdf',
    p_mime_type  => 'application/pdf'
    +);+
    wwv_flow_mail.push_queue(
    P_SMTP_HOSTNAME => 'DESMTP.TEST.COM',
    P_SMTP_PORTNO => '25');
    end;
    The problem is that the function APEX_UTIL.GET_PRINT_DOCUMENT always returns an empty BLOB when executed outside of the APEX application. I found this issue in several other posts in this forum but I did not find a solution.
    The mail transmission itself works perfectly. Also with an attachment if e.g. I use another BLOB already stored in the database for testing purposes. So it is not the mail transmission that causes the problem but the empty variable l_document that is still empty.
    Thanks in advance for the help.

    user9007075 wrote:
    Dear community,
    wwv_flow_api.set_security_group_id;
    you should be using this
        l_workspace_id := apex_util.find_security_group_id (p_workspace => 'YOUR_WORKSPACE_NAME');
        apex_util.set_security_group_id (p_security_group_id => l_workspace_id);
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_util.htm#AEAPI512

  • Apex_util.get_print_document with bind

    All,
    I'm trying to create a process to bulk print a report to the file system using the API apex_util.get_print_document. Is there a way to pass bind variables to the report query when using this API? If not, has anyone come up w/another solution on mass printing reports that have parms?
    Thanks,
    Paul

    Hi Paul,
    APEX_UTIL API consists of 4 different GET_PRINT_DOCUMENT Functions based on parameters types(Function Overloading) that are being passed. If you look at the function where CLOB is the data type for parameter p_report_data, the bind variables can be passed to the SQL which willl be used by DBMS_XMLGEN or other XML/CLOB generation API's.
    I have used DBMS_XMLGEN to generate the CLOB data which intern used by GET_PRINT_DOCUMENT function.
    Regards
    Shesh

  • Apex_util.get_print_document results in "503-service unavailable"

    I'm using APEX 4.2.0.3.00.08 with GlassFish 3.1.2.2 on an Oracle 10.2.0.5 database.
    Recently I created a report-query together with a xsl-fo report-layout created in Altova Stylevision. I've enabled and configured print-options and when I press my application button, I'm perfectly capable of viewing and/or saving the pdf-version of my report.
    Additionally I want to save my report as BLOB in the database, but when I try this using apex_util.get_print_document, all I get in my table is a html-page containing the message "503-service unavailable".
    I used the following page as reference:
    Creating High Fidelity PDF Reports with Oracle Application Express but apparently I'm missing something or doing something wrong......I truly hope there's someone out here to help me!!
    Thanks in advance!

    Hello Mike,
    I've been trying to create an application on apex.oracle.com to reproduce the problem, but I can't seem to get it to work.
    I've uploaded a very simple layout created in StylusStudio, a simple query on the EMP-table only containgin FIRST_NAME, LAST_NAME and EMAIL and when I add the layout to the query and press "Test report", it works fine.
    When I run the report from my application, it only shows a pdf with a thick, horizontal lines, like it's showing only empty cell borders.
    Meanwhile I found out that the APEX-listener keeps reporting similair errors, even when I use that same simple stylesheet (created with StylusStudio) on the EMP-table, even when the stylesheet does not contain any special characters at all. In stead of the message starting with INFO: Character decoding failed. Parameter [#x200B;</xsl:text> , it then ignores the complete xslt-stylesheet (the complete contents of the stylesheet is between the brackets, in stead of just the string containg the special chars).
    To be honest I'm a little lost now. First my focus was on how to get rid of the special characters, but now it looks like, even when I might succeed in that, it doesn't even solve my problem.
    Any idea why my application doesn't show me the same report I see when testing the report-query?
    The application can be found here:
    https://apex.oracle.com/pls/apex/htmldb/f?p=29586
    The bottom region is an attempt to show the pdf with the highest id, but I think it does not show the actual pdf (http-404)
    The source for that PL/SQL region is:
    declare
      src_  varchar2(256);
      mime_ varchar(48);
      id_   number;
    begin
    select max(id)
    into id_
    from report_archive;
        select mimetype
          into mime_
          from report_archive
         where id = id_;
        src_ := 'src="#OWNER#.download_doc?i_doc_id=' || id_ || '" ';
        htp.p('<div style="">');
        if instr(mime_,'pdf') > 0 then
          htp.p('<embed height="800" width="1200" name="statement" ');
        elsif instr(mime_,'excel') > 0 then
          htp.p('<embed height="800" width="1200" name="statement" ');
        else
          htp.p('<embed height="800" name="statement" ');
        end if;
        htp.p(src_);
        htp.p('type="' || mime_ || '" />');
        htp.p('</div>');
    exception
       when no_data_found then
          null;
    end;
    I really hope we can solve this!!!!
    Best regards,
    Marco

  • Apex_util.get_print_document in sql developer

    I have not been successful in getting apex_util.get_print_document to work in sql developer, the return value is always null and inserted into the table. Inside of APEX it works fine, so I figured I had to set workspace id, but that did not help. Heres the basic code.
    declare
    rpt_blob BLOB;
    begin
    wwv_flow_api.set_security_group_id(my ws id);
    rpt_blob := APEX_UTIL.GET_PRINT_DOCUMENT (
    p_application_id => 122,
    p_report_query_name => 'NYARNG_unit',
    p_report_layout_name => 'TEST',
    p_report_layout_type => 'xsl-fo',
    p_document_format => 'pdf',
    p_print_server => null);
    insert into report_archive_tbl values ('test'||sysdate||'.pdf','application/pdf',rpt_blob,sysdate,'tread');
    end;

    Try
    wwv_flow_api.set_security_group_id;instead of wwv_flow_api.set_security_group_id(my ws id);
    Regards,
    Hari

  • Apex_util.get_print_document returns empty blob

    Hi,
    I'm trying to convert a xsl-fo template into PDF. I have the following code:
    begin
    declare
    v_retval blob;
    v_data blob;
    v_xls clob;
    v_xml_dat clob;
    begin
    select page_template
    into v_xls
    from flows_030100.wwv_flow_report_layouts
    where flow_id =101
    and report_layout_name = 'vv';
    v_xml_dat := to_clob('<data><row><dat1>fff</dat1></row></data>');
    v_data := wwv_flow_utilities.clob_to_blob(v_xml_dat);
    v_retval := apex_util.get_print_document (v_data,v_xls,'xsl-fo','pdf')
    htp.p(dbms_lob.getlength(v_retval));
    end;
    end;
    This returns 0 instead of some PDF document. I guess there is something wrong with my input, probably the XML data. Any thoughts?

    Anyone?

Maybe you are looking for

  • What is causing my Safari to crash at least once a day?

    I can't figure it out! I tried the whole plug-in thing where you test and see, but that didn't work. What does my report say? Process: Safari [22619] Path: /Applications/Safari.app/Contents/MacOS/Safari Identifier: com.apple.Safari Version: 5.0.3 (65

  • If i connect an external hard drive to my time capsule will it be backed up on time capsule?

    I recently connected an external hard drive to my time capsule using the usb port on the time capsule.  Will that external hard drive be included in the time machine back up?  If not, how do I include it?

  • Editable shared elements in a template?

    I want to make use of DW Templates to maintain the appearance of the site, but I tend to use templates purely for control of the basic framework of the web pages and then keep all of the shared elements inside include files (I find it easier to updat

  • How to relocate ios backup in Itunes?

    How can I relocate the Itunes IOS backup in Mac? I dont have enough space on my main drive and I want it to save on my external drive. You cant just edit this yourself in Itunes (even after years). I think Apple did this on purpose so people will buy

  • Open pps in Keynote 9

    Currently if I open a PPS by double clicking, it opens in Open Office. How do I change it so it will auto open in Keynote? Thanks