How to trap APEX_UTIL.SET_SESSION_STATE errors like ERR-1002?
Hi team,
i noticed that when i call APEX_UTIL.SET_SESSION_STATE and the relevant page item or application item doesn't exist, this API procedure doesn't return a normal oracle exception but, i guess, it sets some status flag in the Apex engine that causes ERR-1002 to be reported. This is the behaviour i am seeing on Apex 3.1.2 and Apex 3.2.
Is there any way to work around this?
Thank you
Flavio
http://oraclequirks.blogspot.com
Yes I realised it... I think I read your original post too hastily!
I personally don't like tampering with code I don't have full access to... You never know if it will work with the next release or if you have covered all bases. So the solution I decided to use was to override the original apex function with my own (Apex 3.2):
Checks whether a page item exists in the current application.
Returns: TRUE if it does and FALSE otherwise.
FUNCTION page_item_exists(p_name IN VARCHAR2) RETURN BOOLEAN IS
BEGIN
FOR r IN (SELECT i.item_name
FROM apex_application_page_items i
WHERE i.application_id = v('APP_ID')
AND i.item_name = upper(p_name))
LOOP
RETURN TRUE;
END LOOP;
RETURN FALSE;
END;
Set session state.
Raises an exception if the item does not exist.
PROCEDURE set_session_state(p_name IN VARCHAR2,
p_value IN VARCHAR2) IS
BEGIN
IF NOT page_item_exists(p_name => p_name)
THEN
raise_application_error(-20000,
'Item ' || p_name || ' does not exist');
ELSE
apex_util.set_session_state(p_name => p_name, p_value => p_value);
END IF;
END;Luis
Similar Messages
-
How to trap Command Line errors
Sigh. I have searched for 3 hours to the answer for my question. I'm new to scripting, so perhaps this is the problem in my not finding a solution.
In a nutshell, I simply want to gracefully trap command line usage of a script. I want to have my script accept a parameter (ie. a value) and a switch.
Example: <script> -path <path> -set
The problem is that i cannot trap incorrect usage. I would prefer <path> to be position one, and -switch to be position 2 of the parameters passed to the script. I have not tried this "outside" of PS v2.0 ISE (ie. Powershell.exe).
Of course, I would love it to work in both environments.
I KNOW that the ISE will prompt for missing mandatory parameters. Great. But incorrectly specified parameters causes Powershell ISE to "bomb-out". That is, displaying error messages to an uninformed user whom views it as unintelligible.
Example of incorrect usage: <script> -pat <path> -set
Again, I would LOVE to trap this, and display correct USAGE to the screen. Unfortunately, this produces a Powershell error message which has proved unintelligible to "simple" users.
Perhaps I must accept that this is not possible in Powershell v2.0. I simply want to program my script to CATCH this error and take the desired action.
HELP!!! To the knowledgeable and generous Scripting Professionals.
If the directions say go straight, but I turn left, then right: Will I still get there?Okay, I stripped down the script:
<#
===============================================================================
PQSC PowerShell Source File
NAME :
AUTHOR : PQSC.Programmer
DATE :
COMMENT: Expects -->U:\Users\Public\Public Programs\PQSC\Scripts<-- appended to Execution Path
CommandLine to Test=powershell -debug -command "U:\Users\PQSC.Programmer\Documents\WindowsPowerShell\Get-FilesWithArchiveBitSet.ps1" -x
===============================================================================
#>
<# ---------------------------------------------
# Param1 is mandatory, Param2 is optional.
# Param1 should be: -path <path>
# Param2 should be: -Set
#>
[CmdletBinding()]
Param(
[parameter(Mandatory=$true,Position=1)]
[AllowNull()]
[AllowEmptyString()]
[String]
$Path,
[switch]
$Set_Archive
PRODUCES THIS ERROR in PowerShell v2.0 ISE when invoke with:
powershell -debug -command "U:\Users\PQSC.Programmer\Documents\WindowsPowerShell\Get-FilesWithArchiveBitSet.ps1" -x
powershell.exe : Missing expression after unary operator '-'.
At line:1 char:11
+ powershell <<<< -debug -command "U:\Users\PQSC.Programmer\Documents\WindowsPowerShell\Get-untitled2.ps1" -x
+ CategoryInfo : NotSpecified: (Missing express...y operator '-'.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
At line:1 char:2
+ - <<<< debug -command U:\Users\PQSC.Programmer\Documents\WindowsPowerShell\Ge
t-untitled2.ps1 -x
+ CategoryInfo : ParserError: (-:String) [], ParentContainsErrorR
ecordException
+ FullyQualifiedErrorId : MissingExpressionAfterOperator
If the directions say go straight, but I turn left, then right: Will I still get there? -
Error ERR-1002 Unable to find item ID for item "" in application
Hello.
I have same problem like at guy from last message of this thread Error ERR-1002 Unable to find item ID for item "" in application "11501".
I have apex 4.2.1.00.08
Occasionally address box contains comma (f?p=102:LOGIN_DESKTOP:::::,). This bug do not have a logic, just occured.
Could somebody help me?This select
select * from apex_workspace_activity_log t
where t.error_message like '%ERR-1002%'
returns about 40 rows. 1-3 for every day. Mb somebody know about this bug ? -
ERR-1002:unable to find item id for item page_id in applicattion 103
Hi all,
I am a newbie to htmldb with ajax.
My problem is this..
when my javscript calls an on demand process like
------ var get = new htmldb_Get(null,document.getElementById('pFlowId').value,'APPLICATION_PROCESS=pull_contents',0);
-------var id_value = get_check_box_value(document.wwv_flow.f01);
-------get.add('page_id',id_value);
--------var greturn =get.get(null);
process-PULL_CONTENTS
declare
begin
owa_util.mime_header('text/xml', FALSE );
htp.p('Cache-Control: no-cache');
htp.p('Pragma: no-cache');
owa_util.http_header_close;
for rec in(select blob_content as "contents" from obe.file_subjects where id =12)
loop
htp.prn(rec.contents);
end loop;
end;
i get an error in the return text like
ERR-1002:unable to find item id FOR ITEM "PAGE_ID" IN application 103
what can be the problem?Hello,
Your going to have to reproduce it on htmldb.oracle.com, it will be much easier to help you out.
The htmldb_Get() 'is included' on every page by default unless you've done something like comment out the header section of your page template. Look at your page source you should see something like
<script src="/i/javascript/htmldb_html_elements.js" type="text/javascript"></script>
<script src="/i/javascript/htmldb_get.js" type="text/javascript"></script>
in the header section.
Make sure you page template has the #HEAD# substituion tag.
Carl -
How to trap 1843 error. .nOT Valid month..
This is in my cursor for loop
mstart_issue := TO_CHAR(to_date(mstart_issue,'YY-MON'),'Mon.YYYY') ;
mend_issue := to_char(to_date(mend_issue,'YY-MON'),'Mon.YYYY');
But it throws 1843 error..
i Have execptions for finding value error like
when value_error then
warn('value error'||moldmembership);
But i need something to trap the following error ie ..The moment not a valid month error occurs. .It should trap that error
Like warn('not validm onth'||membershpnumber)
What shall be the exeption to catch . .the 1843 error...
Like we got exceptions like when too many rows to catch duplicate records..
And this is how my end_issue data looks like .. . 10-jul
12-Aug date in yy-mon format..
But seems there is error..
Kindly help..
Thankssusf wrote:
Hi Thanks i am implementing both part of code.. Thanks ..
But ..When i use nls_date_language= 'AMERICAN' I see the output of date in some other language in sql
The output is like this..
Loka .2010
Loka .2010
Loka .2010
Loka .2010
Loka .2010
Loka .2010
Loka .2010
Marras.2010
Marras.2010
Marras.2010which line below generates the output above?
Here is the part of my code
declare
msno sub.sno%type;
e;
mSTART_ISSUE sub.start_issue%type;
MEND_ISSUE SUB.END_ISSUE%TYPE;
MCOMMENTS SUB.COMMENTS%TYPE;
MPCODE SUB.POSTCODE%TYPE;
mpay_mode sub.pay_mode%type;
mrmember sub.rmember%type;
mflag varchar2(1);
cursor c1 is select * from htmldb_collections where collection_name = 'CSV_DATA' and c001 != 'SNO';
invalid_month exception;
pragma exception_init( invalid_month, -1843 );
begin
mflag := 'N';
FOR XXX IN C1
LOOP
begin
mrmember := xxx.c023;
mstart_issue := xxx.c019;
mend_issue := xxx.c020;
BEGIN
IF SUBSTR ( UPPER (mstart_issue)
, -3
) IN ( 'JAN', 'FEB', 'MAR'
, 'APR', 'MAY', 'JUN'
, 'JUL', 'AUG', 'SEP'
, 'OCT', 'NOV', 'DEC'
THEN
MSTART_ISSUE := TO_CHAR(to_date(mstart_issue,'YY-MON','NLS_DATE_LANGUAGE=AMERICAN'),'Mon.YYYY') ;
mflag := 'Y';
ELSE
warn('not valid month startissue ' || moldmembership);
mflag := 'N';
END IF;
IF SUBSTR ( UPPER (mend_issue)
, -3
) IN ( 'JAN', 'FEB', 'MAR'
, 'APR', 'MAY', 'JUN'
, 'JUL', 'AUG', 'SEP'
, 'OCT', 'NOV', 'DEC'
THEN
mend_issue := to_char(to_date(mend_issue,'YY-MON','NLS_DATE_LANGUAGE=AMERICAN'),'Mon.YYYY');
mflag := 'Y';
ELSE
warn('not valid month endissue ' || moldmembership);
mflag := 'N';
END IF;
exception
when invalid_month then
warn('EXCEPTIONnot valid month xx ' || moldmembership);
END;
IF mflag = 'Y' then
insert into sub (sno,rno,designation,old,start_issue,end_issue,comments,pay_mode,rmember)
values
(msno,mrno,mdesignation,moldmem e,maddressedas,madd1,
madd2,mcounty,mcity,mstate,mcountry,mph_no,memail,mpostcode,mstart_issue,mend_issue,mco );
end if;
exception
when value_error then
warn('value error'||moldmembership);
end;
END LOOP;
END; -
Trap or redirect APEX messages like ERR-7620
Version: APEX 4.1
Does anyone know of a way to trap/redirect away from workspace messages like ERR-7620. Would prefer to trap and display corporate own error page with custom message.
Thank you in advance.This message happens as a result of a bad URL. In other words, we are not even in or accessing an existing application.
For instance, lets say an apex repository has apps in 1,2,3, in it ... but f?p=4 is sent by an end user. ERR-7620 is displayed cause app id 4 does not exist.
We need a way to trap all APEX system messages so as to not display the white page with the big red X, the error message and then the OK link.
Would be nice to be able to customize that page, but I don't believe that functionality is available in APEX for version 4.1. If I am wrong, please correct me.
Remember, the pages in question are displayed by the APEX engine, not by any of our applications.
We want to provide back a generic/corporate error page, similar to what is done with Apache and its Virtual Host/ErrorDocument setting when an incorrect URL is attempted. -
How to trap No_Data_Found error?
I know how to trap this error in a back-end script:
BEGIN
select empno
into v_empno
where empno = 9999999; --no such employee
EXCEPTION
WHEN NO_DATA_FOUND THEN
However when I use this approach within a trigger in Form 10g, it fails me. I've experimented with DBMS_ERROR_CODE, but so far got nowhere. Can same approach be used in Forms as I'm using above? If not, how should I approach it?
Thanks a lot!You should write something like this......
declare
v_empno emp.empno%type;
begin
begin
select empno into v_empno
from emp
where empno=99999;
exception
when no_data_found
then
message('no employee found');
end;
<any other code >
end;Greetings...
Sim -
hi expert,
in data packet level error like red and .......... like symbol how would i rectified
this type error please expert give me solution i will be give point friends byeHi
If it is the delta update,make the status of that on as STATUS NOT OK and repeat the infopackage again.if it is full run the IP simply.check the data has came to PSA or not,if it has came u push it manually to targets -
how can i buy gem in clash of clans?it give me error like this"the buying is not complited"
If you are also getting a message to contact iTunes Support then you can do so via this link and ask them for help (on these forums we won't know why the message is appearing) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption
-
hi im new apple ,ac book pro user ..Bought a mac 3 weeks before my mac does not show serial number on screen .Also I am unable to sign in imessage n facetime it gives network error like though i can access web site n etc .! What can be this issue n how to solve it??
Hi,
If the machine is brand new I don't see why the serial Number is missing (it is entered on to a special chip at the factory)
However if the machine is a return and has been refurbished then the Logic/mother board may have been changed and someone forgot to put the info back to the new board.
for the Points
7:44 pm Thursday; January 16, 2014
iMac 2.5Ghz 5i 2011 (Mavericks 10.9)
G4/1GhzDual MDD (Leopard 10.5.8)
MacBookPro 2Gb (Snow Leopard 10.6.8)
Mac OS X (10.6.8),
Couple of iPhones and an iPad -
I have had two movie rentals, stop in the middle of downloading tonight, both giving me the error message "(err = 50)" -- It looks like its a network connectivity message, but I'm connected. Any idea on what could be causing this? I cannot find info anywhere!
Thanks for any helpIf you have anti virus software installed, disable that.
Try turning off the Firewall in System Preferences > Security
iTunes: Advanced iTunes Store troubleshooting
It would help when you post to tell us which Mac OS X you have installed. Thank you !! -
How to trap sql errors in a script
Hi,
I have a SQL script where I need to call 5 other SQL scripts. Every of those 5 scripts contain the following code for trapping an sql error:
WHENEVER SQLERROR EXIT sql.sqlcode
whenever oserror exit os.oscode
SET SERVEROUTPUT ON
In the first script that calls the others I put the same code at the begining.
Is it enough for the first script to trap the errors from the others and to show them at runtime?
ThanksYes but test it as we do not necessarily know what you want to script to do when an error occurs.
-
Apex_util.set_session_state issue
Hi
In order to try and workaround the issue reported in Translate substitutions I have been trying to set application item values using apex_util.set_session_state but this doesn't appear to be working.
The problem in the thread was that when the admin user changed the values of substitutions these are only changed in the primary application and not the seeded ones. I understand that we are perhaps using substitutions differently to other people and although this problem has been acknowledged by Oracle I thought there might be a relatively simple solution for us.
What I'd like to do is implement code similar to below as an application process:
BEGIN
FOR i IN (SELECT * FROM apex_application_substitutions
WHERE application_id = :APP_ID) LOOP
apex_util.set_session_state(i.substitution_string||'1', i.substitution_value);
END LOOP;
END;When running the seeded application the APP_ID is that of the primary application. So this code will pick up the values of the substitutions from the primary application and save these as values for similarly named application items in the current session, which we'd then refer to instead. This isn't ideal as we will need to re-write a lot of code, but at least it means we can translate our applications which we can't do at present.
However, the spplication item values are not set. I've done some investigation just looking at the primary application, so ignoring translation and seeded application completely. I've been working on APEX 4.0.2 but found that there was a reported bug, apex_util.set_session_state don't works after upgrade from 4.0.1 to 4.0.2 This may be relevant, but I'm unable to apply the patch. So I've investigated on apex.oracle.com which is APEX 4.1 and I have been able to reproduce the problem. Just incase it matters I've got no authentication or authorization on my application.
The problem can be seen here: http://apex.oracle.com/pls/apex/f?p=56303 The section of interest is the output not the form. Here I've output what I'm doing and the values of the application items after each step. The application items are called SUB_VALUE1 and 2ND_VALUE1 and my substitutions are called SUB_VALUE and 2ND_VALUE. At the end I set the application items to null, so they will always start null. The output is as follows:
(0) SUB_VALUE1 =
(0) 2ND_VALUE1 =
apex_util.set_session_state(i.substitution_string||'1', i.substitution_value);
(1) SUB_VALUE1 =
(1) 2ND_VALUE1 =
apex_util.set_session_state('SUB_VALUE1',i.substitution_value);
(2) SUB_VALUE1 =
(2) 2ND_VALUE1 =
:SUB_VALUE1 := i.substitution_value;
(3) SUB_VALUE1 = Primary App Value
(3) 2ND_VALUE1 =
apex_util.set_session_state('SUB_VALUE1','XYZ');
(4) SUB_VALUE1 = Primary App Value
(4) 2ND_VALUE1 =
apex_util.set_session_state(i.substitution_string||'1', i.substitution_value);
(1) SUB_VALUE1 = Primary App Value
(1) 2ND_VALUE1 =
apex_util.set_session_state('SUB_VALUE1',i.substitution_value);
(2) SUB_VALUE1 = Primary App Value
(2) 2ND_VALUE1 =
:2ND_VALUE1 := i.substitution_value;
(3) SUB_VALUE1 = Primary App Value
(3) 2ND_VALUE1 = Second value
apex_util.set_session_state('2ND_VALUE1','ABC');
(4) SUB_VALUE1 = Primary App Value
(4) 2ND_VALUE1 = Second valueYou can see that no values are set using apex_util.set_session_state, even explicitly stating the application item name and value (e.g. apex_util.set_session_state('2ND_VALUE1','ABC');) does not set or update the value.
This could be as simple as the patch hasn't been included in APEX 4.1 or maybe I am missing something obvious. Unfortunately I'm unable to test this in 4.0.1 or any other version, to see if it's just a problem in 4.0.2 and 4.1.
If someone could confirm if the patch has been included in 4.1 or if this is a new issue. Or perhaps point me to another post answering this (I couldn't find one) or just show me the error of my ways that would be brilliant.
Cheers
SaraFurther, what should the 'Source' be set to for these hidden items.Static Assignment, with Source Used set to Only...
Scott -
Hi!
We have custom authentication scheme with "Page Sentry Function" and "Post-Authentiaction Process" defined.
Page sentry function called wwv_flow_custom_auth.define_user_session procedure.
Post-authentiaction process called apex_util.set_session_state procedure to set some application items.
All works fine until we upgraded from version 4.0.1 to 4.0.2 (patch 10173973).
In verion 4.0.2 apex_util.set_session_state does nothing....
This is a bug or a feature? :)
Thanks.Hi, Patrick!
Test case on http://apex.oracle.com/pls/apex/f?p=31741
1. Run http://apex.oracle.com/pls/apex/f?p=31741 (Values of items F31741_USERID and F31741_USERINFO are not null)
2. Login into apex builder (workspace: WS_AVER, user: VERSALAO, pass: qwerty%)
3. Run page 1. Values of items F31741_USERID and F31741_USERINFO is null
4. Logout from apex builder
5. Run http://apex.oracle.com/pls/apex/f?p=31741 - "ERR-1201 session ID not set on custom authentication" displayed
Where is an error in my code?
Thanks.
Edited by: user12288359 on 25/11/2010 7:23 -
Trapping jsp compilation errors
I'd like to trap jsp compilation errors and have an error page displayed instead,
but I am currently having difficulty doing this using 6.1 sp1. I've tried a number
of things in the web.xml file:
1) using the error-page directive to trap error code 500
2) using the error-page directive to trap weblogic.servlet.jsp.JspException
3) using the error-page directive to trap java.lang.RuntimeException
4) using the error-page directive to trap java.lang.Exception
In all cases, an error code of 500 is returned to the client instead of my error
page being called.
Any suggestions or insights?
Thanks...
Steve...
Unfortunately, this isn't an option for us because the pages are created on demand,
so our only chance to capture compilation errors is during the fulfillment of
the client's request. We do not anticipate any compilation errors, but then again,
you can't anticipate everything.
Steve...
Nils Winkler <[email protected]> wrote:
>Hi,
>
>this might not be what you're looking for, but how about precompiling
>the jsp files before they are deployed? This way you will hit
>compilation before deploying the JSP files to the server.
>
>Nils
>
>Steve Gamble wrote:
>>
>> To trap the 500 error:
>>
>> <error-page>
>> <error-code>500</error-code>
>> <location>/internalerror.do</location>
>> </error-page>
>>
>> To trap exceptions:
>>
>> <error-page>
>> <exception-type>javax.servlet.ServletException</exception-type>
>> <location>/internalerror.do</location>
>> </error-page>
>>
>> where similar blocks for
>> - javax.servlet.jsp.JspException
>> - java.lang.Exception
>> - java.lang.RuntimeException
>> - weblogic.servlet.jsp.JspException
>>
>> If I modify my code to deliberately throw a ServletException, then
>the error-page
>> is used correctly. If I modify a jsp so that it has a syntax error,
>then the
>> compilation exception is not caught by any of the error-page directives.
>>
>> Thanks in advance...
>> Steve...
>>
>> "Bob Lee" <[email protected]> wrote:
>> >Can you post the directive you are using?
>> >
>> >Bob
>> >
>> >"Steve Gamble" <[email protected]> wrote in message
>> >news:[email protected]...
>> >>
>> >> I'd like to trap jsp compilation errors and have an error page displayed
>> >instead,
>> >> but I am currently having difficulty doing this using 6.1 sp1.
>I've
>> >tried
>> >a number
>> >> of things in the web.xml file:
>> >>
>> >> 1) using the error-page directive to trap error code 500
>> >> 2) using the error-page directive to trap
>> >weblogic.servlet.jsp.JspException
>> >> 3) using the error-page directive to trap java.lang.RuntimeException
>> >> 4) using the error-page directive to trap java.lang.Exception
>> >>
>> >> In all cases, an error code of 500 is returned to the client instead
>> >of my
>> >error
>> >> page being called.
>> >>
>> >> Any suggestions or insights?
>> >>
>> >> Thanks...
>> >> Steve...
>> >
>> >
>
>--
>============================
>[email protected]
Maybe you are looking for
-
Can't view rest of document in Dreamweaver CS3
I'm a long-time GoLive user who has converted a number of sites to Dreamweaver over the past few months. Yesterday I began to convert an 1100-page PHP web site, representing my largest and most complex client site. What I noticed immediately is that
-
i want to know how is possible to extract data from Icloud for a list mobile
-
I ordered the above iMac yesterday (10-2) and received an email tonight that the item is now on backorder. A one to two week backorder period was estimated. How accurate is this based on actual experience? I am disappointed that there was no mention
-
Showing subscribed/unsubscribed podcasts in list view
With past iTunes in List view I could quickly see to the right of the Podcast name, to what I am subscribed. Equally important I could note a desirable podcast that is currently unsubscribed. I do not see an easy way to do this with the current iTune
-
Remove standard button in ALV LIKE APPEND/INSERT/DELETE
Hi Expert, I have a requirement in which we do not need APPEND/INSERT/DELETE button in ALV,Can you please tell how i can remove that. Pleaae suggest. Thanks Mahesh