No error in PL/SQL, but error in Apex
Hi All. I have configured the code from the How-to on uploading a spreadsheet to suit my own needs. It is the cut and paste method.
In SQL developer I run:
BEGIN
conversion_upload.process_text('Argentina Peso 0.3243000 3.0836
Australia Dollar 0.7432000 1.3455
Belgium Euro 1.2792000 0.7817
END;
Uploads the 2 rows fine, places them into their rows and everything is great.
I then cut and paste the same data into my Apex Text area, which is tied to a submit button process. text area is named P8_UPLOAD, process is as follows :
conversion_upload.process_text(:P8_UPLOAD);
When I submit in APEX I get an Invalid number error, ora-01722 ...
how can this not be working if it is working fine in PLSQL?
got it figured out... man what a pain in the behind though.
I was getting an extra chr(13) in it through apex, but when I ran it through SQL Dev. it was converting all chr(13)s to chr(10)s.
So in apex I had extra whitespace that was throwing it out.
Similar Messages
-
Query running ok in SQL but giving error in form trigger
Hi guys
here is the query
SELECT NVL(BGM_PERAMT,0) INTO PERAMT FROM BROKERAGE_MASTER
WHERE BGM_BROKERAGETYPE = 'BR01' AND BGM_PERAMT <> 0
The above query working fine in SQL but giving following error in when_button_pressed trigger
[In a host language program, all records have been fetched. The return code from the fetch was +4 indicating that all records have been returned from the SQL query. ]
please give me the solution for this problem.
It is very urgent
regards
ashaok below is the code
CURSOR RESALE_BROKERAGE IS SELECT am_brokerCd resalebrcd,'' resalesbrcd,NVL(SUM(AM_AMT),0) RESALE_AMT,COUNT(AM_RESALENO) TOTCNT,NVL(SUM(AM_UNITSAPPLD),0) RESALE_UNITS
FROMRNT_RESALE_MASTER
WHERE am_brokercd is not null AND AM_PROCTAG='Y' AND
(to_date(to_char(AM_PROCDT,'DD/MON/YYYY')) BETWEEN
to_date(to_char(:rnt_broker_date.fromdt,'DD/MON/YYYY')) AND
to_date(to_char(:rnt_broker_date.todate,'DD/MON/YYYY')))
GROUP BY am_brokerCd
UNION
SELECT AM_BROKERCD resalebrcd,
am_subbrokercd resalesbrcd,
NVL(SUM(AM_AMT),0) RESALE_AMT,COUNT(AM_RESALENO) TOTCNT,
NVL(SUM(AM_UNITSAPPLD),0) RESALE_UNITS
FROM RNT_RESALE_MASTER
WHERE am_brokercd is not null AND AM_PROCTAG='Y' AND AM_BROKERCD = 'ARN-9760' AND (to_date(to_charAM_PROCDT,'DD/MON/YYYY')) BETWEEN
to_date(to_char(:rnt_broker_date.fromdt,'DD/MON/YYYY')) AND
to_date(to_char(:rnt_broker_date.todate,'DD/MON/YYYY')))
GROUP BY AM_BROKERCD,am_subbrokercd;
Asha -
Trigger error but only in Apex
I have a trigger with the following insert statement:
insert into oe_headers_iface_all(order_source_id,orig_sys_document_ref,order_type_id, created_by,creation_date,last_updated_by,last_update_date, sold_from_org_id,sold_to_org_id,operation_code,booked_flag)
values(1023, 'TESTING', 1116, 0, sysdate, 0, sysdate, 225,65372,'INSERT','N');
This trigger runs fine outside of Apex; it doesn't error and inserts those values into that table. But when I insert a record into my table through Apex, I get the following error:
ORA-01722: invalid number ORA-06512: at "APPS.RMA_TRACKER_T1", line 144 ORA-04088: error during execution of trigger 'APPS.RMA_TRACKER_T1'
If I comment out that insert statement it runs in Apex and does not error.
Any idea at all what could be making Apex so mad at this insert statement? It says "invalid number" but I've checked the fields over and over, and like I said if I just run that statement myself or insert a record in my table manually it runs and doesn't error, so Apex appears to be lying to me. Also, the Apex version is 4.0.1.00.03.
Edited by: Cydonia on May 25, 2011 3:54 PM<sigh> I HATE problems like the one you described. VERY painful to deal with.
Let's review what you said.
1. the insert is fine outside apex
2. The insert crashes from within Apex with ORA-01722. Of course Oracle is not telling you which value
3. You already checked the "fields" over and over (no doubt!). Do you mean the datatypes or the data values?
insert into oe_headers_iface_all(order_source_id,orig_sys_document_ref,order_type_id, created_by,creation_date,last_updated_by,last_update_date, sold_from_org_id,sold_to_org_id,operation_code,booked_flag)
values(1023, 'TESTING', 1116, 0, sysdate, 0, sysdate, 225,65372,'INSERT','N'); I don't see anything unusual about the INSERT. Are the insert values really hard-coded like this? Pretty simple!
Any idea at all what could be making Apex so mad at this insert statement? It says "invalid number" but I've checked the fields over and over, and like I said if I just run that statement myself or insert a record in my table manually it runs and doesn't error, so Apex appears to be lying to me. Also, the Apex version is 4.0.1.00.03.Is the INSERT occurring through a PL/SQL routine you are executing via Apex or automatically through page submission?
Add debugging statements in the trigger to record every number and date field (convert to strings) in the trigger to find out what values you are dealing with. Either use htp.p to display character representations of the values OR write a quick debugging function using autonomous transaction to save and commit the values internally. If you use a debugging table concatenate all of thee fields together as strings to minimize the chances of getting the same error; make sure you enclose values in double quotes "'" to flag nulls in case something is being unexpectedly changed.
Something is happening that you don't suspect. Your VALUES list is straightforward and hard-coded so I wonder if trigger logic is trying to modify one of the values you listed. Perhaps multiple triggers and/or procedures and functions are involved.
Good luck! -
Abnormal, Same query get data in sql but not working on Fron-end
Dear,
Version :Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
We have created packed in oracle database befor two months ago & was working fine, but since morning select statment in package is not working while running via application which mentioned below and raise not data found but surprising thing is that same query is getting data when we execut on sql plus return one record.
i don't know either it's abnormal behaviour or sth else becuase the same query run without changing any singl column in where_clause work in sql but not getting data while submition request through oracle application and raising not data found.
--thankse
Edited by: oracle0282 on Dec 29, 2011 2:20 AMActully when i run this query in sql it return one record on the same parameter, while when we exeucte this select in pl/sql on the same parameter oracle raise no data found error.
so i got confused the same query with same parameter retur record in sql but when we call it fron-end through packege raise 'no data found error'.
hope you understand now.
--thanks -
ORA-01858 error from Apex Report on working/valid underlying query
After two days of searching these forums and AskTom, I think I need to post the following problem.
I have what seems to be a valid view of some data created as follows (with an apology for the formatting - doesn't seem to be a way of using a fixed font here):
CREATE OR REPLACE FORCE VIEW "PRICING_CAPABILITY"."POW_EXEC_SUMM010" ("Item",
"Jul-09", "Aug-09", "Sep-09", "Oct-09", "Nov-09", "Dec-09", "Jan-10",
"Feb-10", "Mar-10", "Apr-10", "May-10", "Jun-10", "YTD")
AS
SELECT
"Item",
SUM(DECODE("ItemMonth",'Jul-09',"ItemValue",0)) "Jul-09",
SUM(DECODE("ItemMonth",'Aug-09',"ItemValue",0)) "Aug-09",
SUM(DECODE("ItemMonth",'Sep-09',"ItemValue",0)) "Sep-09",
SUM(DECODE("ItemMonth",'Oct-09',"ItemValue",0)) "Oct-09",
SUM(DECODE("ItemMonth",'Nov-09',"ItemValue",0)) "Nov-09",
SUM(DECODE("ItemMonth",'Dec-09',"ItemValue",0)) "Dec-09",
SUM(DECODE("ItemMonth",'Jan-10',"ItemValue",0)) "Jan-10",
SUM(DECODE("ItemMonth",'Feb-10',"ItemValue",0)) "Feb-10",
SUM(DECODE("ItemMonth",'Mar-10',"ItemValue",0)) "Mar-10",
SUM(DECODE("ItemMonth",'Apr-10',"ItemValue",0)) "Apr-10",
SUM(DECODE("ItemMonth",'May-10',"ItemValue",0)) "May-10",
SUM(DECODE("ItemMonth",'Jun-10',"ItemValue",0)) "Jun-10",
SUM("ItemValue") AS "YTD"
FROM
SELECT
'New Proposals Received' AS "Item",
TO_CHAR(t1.scope_received,'Mon-RR') AS "ItemMonth",
COUNT(*) AS "ItemValue",
10 AS "SortOrder"
FROM
PRICING_CAPABILITY.POW_DATA t1
WHERE
t1.scope_received IS NOT NULL
AND extract(YEAR FROM t1.scope_received) IN (2009,2010)
AND t1.scope_received >= '01-JUL-2009'
GROUP BY
'New Proposals Received',
TO_CHAR(t1.scope_received,'Mon-RR'),
10
UNION
SELECT
'New Proposals Completed' AS "Item",
TO_CHAR(t2.pricing_approval,'Mon-RR') AS "ItemMonth",
COUNT(*) AS "ItemValue",
20 AS "SortOrder"
FROM
PRICING_CAPABILITY.POW_DATA t1
JOIN PRICING_CAPABILITY.POW_LAST_HISTORY t2
ON
t1.POW_DATA_ID = t2.POW_DATA_ID
WHERE
t2.pricing_approval IS NOT NULL
AND extract(YEAR FROM t2.pricing_approval) IN (2009,2010)
AND t2.pricing_approval >= '01-JUL-2009'
GROUP BY
'New Proposals Completed',
TO_CHAR(t2.pricing_approval,'Mon-RR')
GROUP BY
"Item",
"SortOrder"
ORDER BY
"SortOrder" ;
This view works, ie produces the right results when run (ie select * from ...) in SQL Developer and in the SQL Workshop section of Apex.
But when I attempt to produce an Apex report using it as the source of data, I get the following error:
ORA-01858: a non-numeric character was found where a numeric was expected
The error is displayed before any part of the report itself is displayed, ie the Region Header is displayed and then the error message.
So far, anything I've been able to find on the forums or AskTom suggests that it is probably due to a date conversion problem. But the aim here is to summarise dated records by month, so I'm extracted the year and month elements of the date values, converting them to strings (using TO_CHAR), and then using the resulting 'Mon-YY' strings to group the results.
If there is a better way, I'm interested.
But I don't understand why Apex seems to be rejecting what appear to be valid results from a valid working query.
Any ideas? Suggestions?
Cheers,
PeterThanks again, Flavio. I'm learning and I appreciate your patience.
The solution you provided is very similar to the one I came up with after your previous message, but I didn't have the NLS_DATE_LANGUAGE parameter. I'll go back and try it.
I appreciate your explanation re Apex not needing to know and Oracle assuming that the client knows what it is doing, but it puzzles me more.
The way that I originally had things, I think, was consistent with what you have explained, but it didn't work. To make it clear:
1 I had an Oracle view that had no parameters and contained the date literal in the where clause and worked fine in both SQL Developer and in the Apex SQL Workshop.
2 The view did not return any date values. Aside from the column headings and the first column (of character strings), the body of the table comprised integer values only.
3 So, when Apex called the view, I would have expected the Oracle server to independently execute the view and return the (dateless) results to Apex, which would then present the unmodified results in a standard report. This is, I think, what SQL Developer and the Apex SQL Workshop appear to have successfully done.
My expectation seems to be consistent with at least some of your explanation (ie [Oracle assumes] "+that the client knows what it is doing+" and "+apex doesn't need to know anything about the underlying query+"), but is not consistent with actual experience, where Apex seems to know that the underlying query contains a date literal and unsuccessfully (and unnecessarily) attempts to interpret it.
I'm obviously missing something about how Apex and Oracle interact in this situation. While I don't need to know - as I have a working solution now - it is valuable to understand how things work. Makes life easier and more productive.
Cheers,
Peter -
Database Trigger gives error in APEX form
Hi
I have a table that has an on insert and on update trigger on the database table that is in the apex form. when applying changes or creating a new row fields are populated in the table for who and date. This works as expected but not in APEX.
in apex when trying to create or apply changes the following error is given
ORA-20505: Error in DML: p_rowid=hello, p_alt_rowid=ID, p_rowid2=, p_alt_rowid2=. ORA-06502: PL/SQL: numeric or value error: character string buffer too small ORA-06512: at "AIT_MSTR.UPDATE_ACCOUNT_ROW", line 9 ORA-04088: error during execution of trigger 'AIT_MSTR.UPDATE_ACCOUNT_ROW'
Error Unable to process row of table ACCOUNT.
I am not sure, but I think this error is around the DATE field in the row. How can APEX be modified to not error out on the execution of the trigger?
the trigger is very simple
CREATE OR REPLACE TRIGGER AIT_MSTR.UPDATE_ACCOUNT_ROW
BEFORE UPDATE
OF ID
,DESCRIPTION
,CONNECT_ONLY
ON AIT_MSTR.ACCOUNT
REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
NAME: UPDATE_ACCOUNT_ROW
PURPOSE:
REVISIONS:
Ver Date Author Description
1.0 6/9/2011 1. Created this trigger.
NOTES:
Automatically available Auto Replace Keywords:
Object Name: UPDATE_ACCOUNT_ROW
Sysdate: 6/9/2011
Date and Time: 6/9/2011, 11:39:59 AM, and 6/9/2011 11:39:59 AM
Username: (set in TOAD Options, Proc Templates)
Table Name: ACCOUNT (set in the "New PL/SQL Object" dialog)
Trigger Options: (set in the "New PL/SQL Object" dialog)
BEGIN
:NEW.Update_Date := SYSDATE;
:NEW.Updated_By := USER;
EXCEPTION
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
RAISE;
END UPDATE_ACCOUNT_ROW;
Any help is greatly appreciatedHi
Yes you are correct it was the length of the Created_by and Updated_by column. i had to increase the size of those columns in the table
Now it works.
HOWEVER, it is not capturing the user name of the person logging into APEX that is creating or updating the record. The entry I see in the created_by or updated_by is ANONYMOUS. Which is not want is needed to be captured and recorded. Where is this anonymous value coming from and how can i get it to be the id of the APEX user instead?
Any help is greatly appreciated on this new issue -
Obvious Error in APEX 4.1
Hi friends,
While trying to use APEX 4.1, im facing the below error then and there
Error ORA-01403: no data found
Technical Info (only visible for developers)
* is_internal_error: false
* ora_sqlcode: 100
* ora_sqlerrm: ORA-01403: no data found
* component.type: APEX_APPLICATION_PAGE_PROCESS
* component.id: 122577129813507993
* component.name: Fetch Row from *XXHY_AMS_TRV_OM*---->this might be my table name
* error_backtrace:
ORA-06512: at "SYS.WWV_DBMS_SQL", line 904
ORA-06512: at "APEX_040100.WWV_FLOW_DYNAMIC_EXEC", line 618
ORA-06512: at "APEX_040100.WWV_FLOW_DML", line 317
ORA-06512: at "APEX_040100.WWV_FLOW_PROCESS", line 322
OK
What does this error try to say. What are all the reasons for this error to occur.
How to rectify this error in APEX, once it occurred.
In my scenario, i faced the above error when i clicked the edit button in my report.
Brgds,
MiniHi Mini,
I have a few questions.
1) Does the primary key exist which the fetch process tries to query?
2) Do you have an extra where clause defined for the fetch process?
3) When you run the page in debug mode, is the statement which gets executed by the fetch process what you expect?
4) When you run that statement with the primary key value from SQL Workshop -> SQL Commands, do you get a result?
Regards
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
ORA-01031: insufficient privileges in PL/SQL but not in SQL
I have problem with following situation.
I switched current schema to another one "ban", and selected 4 rows from "ed"
alter session set current_schema=ban;
SELECT * FROM ed.PS WHERE ROWNUM < 5;
the output is OK, and I get 4 rows like
ID_S ID_Z
1000152 1
1000153 1
1000154 1
1000155 1
but following procedure is compiled with warning
create or replace
procedure proc1
as
rowcnt int;
begin
select count(*) into rowcnt from ed.PS where rownum < 5;
end;
"Create procedure, executed in 0.031 sec."
5,29,PL/SQL: ORA-01031: insufficient privileges
5,2,PL/SQL: SQL Statement ignored
,,Total execution time 0.047 sec.
Could you help me why SELECT does work in SQL but not in PL/SQL procedure?
Thanks.
Message was edited by:
MattSkPrivs granted via a role are only valid from SQL - and not from/within stored PL/SQL code.
Quoting Tom's (from http://asktom.oracle.com) response to this:I did address this role thing in my book Expert one on one Oracle:
<quote>
What happens when we compile a Definer rights procedure
When we compile the procedure into the database, a couple of things happen with regards to
privileges. We will list them here briefly and then go into more detail:
q All of the objects the procedure statically accesses (anything not accessed via dynamic SQL)
are verified for existence. Names are resolved via the standard scoping rules as they apply to the
definer of the procedure.
q All of the objects it accesses are verified to ensure that the required access mode will be
available. That is, if an attempt to UPDATE T is made - Oracle will verify the definer or PUBLIC
has the ability to UPDATE T without use of any ROLES.
q A dependency between this procedure and the referenced objects is setup and maintained. If
this procedure SELECTS FROM T, then a dependency between T and this procedure is recorded
If, for example, I have a procedure P that attempted to 'SELECT * FROM T', the compiler will first
resolve T into a fully qualified referenced. T is an ambiguous name in the database - there may be
many T's to choose from. Oracle will follow its scoping rules to figure out what T really is, any
synonyms will be resolved to their base objects and the schema name will be associated with the
object as well. It does this name resolution using the rules for the currently logged in user (the
definer). That is, it will look for an object owned by this user called T and use that first (this
includes private synonyms), then it will look at public synonyms and try to find T and so on.
Once it determines exactly what T refers to - Oracle will determine if the mode in which we are
attempting to access T is permitted. In this case, if we as the definer of the procedure either
owns the object T or has been granted SELECT on T directly or PUBLIC was granted SELECT, the
procedure will compile. If we do not have access to an object called T by a direct grant - the
procedure P will fail compilation. So, when the object (the stored procedure that references T) is
compiled into the database, Oracle will do these checks - and if they "pass", Oracle will compile
the procedure, store the binary code for the procedure and set up a dependency between this
procedure and this object T. This dependency is used to invalidate the procedure later - in the
event something happens to T that necessitates the stored procedures recompilation. For example,
if at a later date - we REVOKE SELECT ON T from the owner of this stored procedure - Oracle will
mark all stored procedures this user has that are dependent on T, that refer to T, as INVALID. If
we ALTER T ADD some column, Oracle can invalidate all of the dependent procedures. This will cause
them to be recompiled automatically upon their next execution.
What is interesting to note is not only what is stored but what is not stored when we compile the
object. Oracle does not store the exact privilege that was used to get access to T. We only know
that procedure P is dependent on T. We do not know if the reason we were allowed to see T was due
to:
q A grant given to the definer of the procedure (grant select on T to user)
q A grant to public on T (grant select on T to public)
q The user having the SELECT ANY TABLE privilege
The reason it is interesting to note what is not stored is that a REVOKE of any of the above will
cause the procedure P to become invalid. If all three privileges were in place when the procedure
was compiled, a revoke of ANY of them will invalidate the procedure - forcing it to be recompiled
before it is executed again. Since all three privileges were in place when we created the procedure
- it will compile successfully (until we revoke all three that is). This recompilation will happen
automatically the next time that the procedure is executed.
Now that the procedure is compiled into the database and the dependencies are all setup, we can
execute the procedure and be assured that it knows what T is and that T is accessible. If something
happens to either the table T or to the set of base privileges available to the definer of this
procedure that might affect our ability to access T -- our procedure will become invalid and will
need to be recompiled.
This leads into why ROLES are not enabled during the compilation and execution of a stored
procedure in Definer rights mode. Oracle is not storing exactly WHY you are allowed to access T -
only that you are. Any change to your privileges that might cause access to T to go away will cause
the procedure to become invalid and necessitate its recompilation. Without roles - that means only
'REVOKE SELECT ANY TABLE' or 'REVOKE SELECT ON T' from the Definer account or from PUBLIC. With
roles - it greatly expands the number of times we would invalidate this procedure. If some role
that was granted to some role that was granted to this user was modified, this procedure might go
invalid, even if we did not rely on that privilege from that role. ROLES are designed to be very
fluid when compared to GRANTS given to users as far as privilege sets go. For a minute, let's say
that roles did give us privileges in stored objects. Now, most any time anything was revoked from
ANY ROLE we had, or any role any role we have has (and so on -- roles can and are granted to roles)
-- many of our objects would become invalid. Think about that, REVOKE some privilege from a ROLE
and suddenly your entire database must be recompiled! Consider the impact of revoking some system
privilege from a ROLE, it would be like doing that to PUBLIC is now, don't do it, just think about
it (if you do revoke some powerful system privilege from PUBLIC, do it on a test database). If
PUBLIC had been granted SELECT ANY TABLE, revoking that privilege would cause virtually every
procedure in the database to go invalid. If procedures relied on roles, virtually every procedure
in the database would constantly become invalid due to small changes in permissions. Since one of
the major benefits of procedures is the 'compile once, run many' model - this would be disastrous
for performance.
Also consider that roles may be
q Non-default: If I have a non-default role and I enable it and I compile a procedure that
relies on those privileges, when I log out I no longer have that role -- should my procedure become
invalid -- why? Why not? I could easily argue both sides.
q Password Protected: if someone changes the password on a ROLE, should everything that might
need that role be recompiled? I might be granted that role but not knowing the new password - I
can no longer enable it. Should the privileges still be available? Why or Why not? Again, arguing
either side of this is easy. There are cases for and against each.
The bottom line with respect to roles in procedures with Definer rights are:
q You have thousands or tens of thousands of end users. They don't create stored objects (they
should not). We need roles to manage these people. Roles are designed for these people (end users).
q You have far fewer application schema's (things that hold stored objects). For these we want
to be explicit as to exactly what privileges we need and why. In security terms this is called the
concept of 'least privileges', you want to specifically say what privilege you need and why you
need it. If you inherit lots of privileges from roles you cannot do that effectively. We can manage
to be explicit since the number of development schemas is SMALL (but the number of end users is
large)...
q Having the direct relationship between the definer and the procedure makes for a much more
efficient database. We recompile objects only when we need to, not when we might need to. It is a
large efficiency enhancement.
</quote> -
DB Link - works via SQL but not via packages
I have a database link on user ODB on database A, to database B. The DB Link seems fine for SQLs that i do, but doesn't compile in my package code. Please tell me why it works for "regular sqls" but not inside a package.
Example: while connected as ODB user on database A, if I do this query:
SELECT "TRAXDOC_DETAIL"."FILE_NAME",
"TRAXDOC_DETAIL"."FILE_TYPE",
FROM "TRAXDOC_DETAIL"@TRAXDOC_LINK
WHERE "TRAXDOC_DETAIL"."TRAXDOC_ROW_ID" = 100031 AND
"TRAXDOC_DETAIL"."TRAXDOC_LINE"= 2
It works fine. But the same query inside a package that is owned by user ODB on database A will not compile, stating the table/view does not exist.
The database link is owned by use ODB on database A, connects directly to the owner of the tables in question on database B.
Any suggestions welcome... this is an urgent issue, because it also worked fine on my customer's test environment, but not on their Production that they just upgraded. I need to know what to look for as to what could be wrong.Thanks so much for your response - Prefixing the call to the table within the package, with the schema owner does indeed solve the problem. Since this is a Production issue, i have implemented this fix in my customer's database.
However, I would still like this issue permanently resolved. The next time we send out updated package code, this will happen again (unless we then fix it again). I'd still like info from anyone on what exactly must be done to allow the call within the package to work without specifically pre-fixing the table's schema owner. It shouldn't be needed... The DB link is connecting via the same schema on database B that owns the table in question.
pre-fixing the schema owner is something we don't do in our sql statements, and this has worked fine for many of our cusomer's environments. We're only seeing this issue on one environment. -
Can i import .sql file into oracle apex?
i'm new to oracle apex....
Can i import .sql file into oracle apex?
i've to import a table into apex...
what script i have to write into the .sql file....
pls help...
Edited by: 794244 on Jan 31, 2011 9:31 PMHi Mahesh
Navigate to the APEX documentation page - all the documents are listed there ;) (including direct links to the step-by-step "how-to's" - great stuff)
http://www.oracle.com/technetwork/developer-tools/apex/documentation/index.html
Enjoy the wonderful world of APEX!
Mike -
Simple SQL, but i get an error?
Here's my code:
<cfquery name="setNote"
datasource="#DS#" dbtype="ODBC"
username="#DSUsername#" password="#DSPassword#"
>
update Notes set note = 'test' where noteid = 1
</cfquery>
Seems simple enough, but I get this:
[Macromedia][SequeLink JDBC Driver][ODBC
Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in
UPDATE statement.
Yeah, I know "Access Sucks.", but this still seems like it
should work, no?
If I do a "select * from notes" and cfdump the results, I see
the data that is there, I just can't update it.
What am I missing here?duplicate post. answered in db access forum.
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/ -
Db link error in PL/SQL but not in SQL
oracle 10.2.0.4
solaris 10
I have a simple procedure (anonymous block) that uses a db link to update a table in another db (on same host)
The procedure fails with the following error:
ORA-02019: connection description for remote database not found
I can insert records using the same db_link using the exact same line pasted from the stored proc (same line that raises the ORA-02019).
insert into table_x@my_db_link (select * from local_table_y);
x rows inserted
I use the same sql*plus session to run both the stored proc and sql command;
SQL> conn my_user/my_pwd
connected
SQL> @my_proc.sql
ORA-02019: connection description for remote database not found
SQL> insert into table_x@my_db_link (select * from local_table_y);
x rows inserted
QUESTION:
Why does the db_link fail in the procedure and not the sql command line call?
P.S.
I converted the procedure to a store proc and it also fails with the same call.Perhaps if the Database link is non-public?There is a bug, #3240720, which applies when the owner of the db link is not the user who's executing the query.
There are several bugs which demonstrate this sort of behaviour. For instance ORA-2019 can be hurled if the local PL/SQL is running against a remote Dataguard standby database (although I would hope we wouldn't be running an INSERT in that scenario).
Cheers, APC
blog: http://radiofreetooting.blogspot.com -
Query run in Sql prompt correctly but give error in APEX report ORA-01843
Hi. all APEX user
Last week I upgrade APEX 3.2 to 4.0.2 . Now i have a problem. PL/SQL reports which are working in APEX 3.2 not working in 4.0.2. Help me.....
I am working on a mission critical application we have to upgrade there next month.
Query code is :-
select * from (
Select pp.PAYMENT_DATE,pp.PATIENT_ID,p.name as name,pa.Service_Subtype,pp.PAYMENT_RECEIPT_ID,pa.Ward_Type,(pp.TOTAL_CHARGE-pp.discount) as amount ,pa.Service_Booked_By,pp.PAYMENT_COLLECTOR,
case when pp.discount=0 then 1
when pp.TOTAL_CHARGE = pp.discount then 3
else 2
end payment_status
from patients p,PATIENT_Payment pp,PATIENT_account pa where p.patient_id = pp.patient_id and pp.patient_id=pa.patient_id and pa.SERVICE_SUBTYPE=pp.SERVICE_SUBTYPE AND pp.SERVICE_REGISTRATION_ID=pa.SERVICE_REGISTRATION_ID and
(pp.PAYMENT_DATE>=to_date(:P15_date_from,'dd-mon-rr')) AND
(pp.PAYMENT_DATE<=to_date(:P15_date_to,'dd-mon-rr'))AND
(pa.GROUP_NAME=:p15_Group or :p15_Group='ALL') AND
(pp.service_type=:p15_Service_Type or :p15_Service_Type='ALL') AND
(pp.SERVICE_SUBTYPE=:p15_SERVICE_SUBTYPE or :p15_SERVICE_SUBTYPE='ALL') AND
(pa.WARD_TYPE=:p15_Ward or :p15_Ward='ALL') AND
(pp.PAYMENT_COLLECTOR=:p15_Collector or :p15_Collector='ALL')
)order by pp.PAYMENT_DATE
) where payment_status=:p15_status
order by 1In your query, you expect the date to have the format 'dd-mon-rr'. Have you checked if the format of the date-items is of this format?
-
How to Correctly Trap PL/SQL Errors for APEX
This is probably a simple fix but, I have been at it for a while and can't seem to find the magic combination.
I have a page process that calls back end PL/SQL. I have a page item that is populated by said PL/SQL procedure, P35_PROCESSING_MSG. As you know the Process allows me to specify a message for Success and another for Failure. My desire is that, if there is a back end failure, the error will display in the dialog area, using the built-in "Process Error Message" functionality. Instead, after execution, the page item still has its default value and the following, ugly, error displays in the tabular report region.
report error:
ORA-20001: Error fetching column value: ORA-01403: no data found
ORA-06510: PL/SQL: unhandled user-defined exceptionI just don't get why it displays here instead of in the usual failure area. Moreover, I don't understand why the error is "*+unhandled+* user-defined exception" when, as you will see, I have handled it.
I have a page process to perfom custom MRD for a tabular form. (I don't think this is really germane to the more generic issue but, I bring it up as an explanaintion for the following code sample). I am diliberately causing a DIVIDE BY ZERO error to test the error handling form the back end.
PROCEDURE PROCESS_MARGIN_CALL_DELETES( as_StatusMsg OUT VARCHAR2 )
IS
lb_InnerErrorOccured BOOLEAN := FALSE;
ln_DeleteTargetCnt NUMBER := 0;
ln_DeleteTargetRow NUMBER := 0;
BEGIN
ln_DeleteTargetCnt := apex_application.g_f01.COUNT;
FOR ln_DeleteTargetIndx IN 1..ln_DeleteTargetCnt
LOOP
ln_DeleteTargetRow := apex_application.g_f01(ln_DeleteTargetIndx);
BEGIN
If ( apex_application.g_f14.EXISTS(ln_DeleteTargetRow) ) Then
select 1/0 into ln_DeleteTargetCnt from dual;
DELETE FROM RISKDM2.INTRADAY_ECS_RSKALYST_MRGCALL
WHERE RISK_MARGCALL_ID = apex_application.g_f14(ln_DeleteTargetRow);
End If;
EXCEPTION
WHEN OTHERS THEN
as_StatusMsg := as_StatusMsg || SQLERRM;
lb_InnerErrorOccured := TRUE;
END;
END LOOP;
If ( lb_InnerErrorOccured = TRUE ) Then
RAISE INNER_EXCEPTION;
Else
as_StatusMsg := 'Successfully Processed';
End If;
EXCEPTION
WHEN INNER_EXCEPTION THEN
RAISE_APPLICATION_ERROR( -20001, as_StatusMsg );
WHEN OTHERS THEN
as_StatusMsg := as_StatusMsg || SQLERRM;
RAISE_APPLICATION_ERROR( -20000, as_StatusMsg );
END; The associated code in APEX is short and sweet:
BEGIN
MBRDATA.MEMBER_MGR.PROCESS_MARGIN_CALL_DELETES( :P35_PROCESSING_MSG );
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR( -20002, :P35_PROCESSING_MSG );
END;What I am missing?
-JoeJoe Upshaw wrote:
This is probably a simple fix but, I have been at it for a while and can't seem to find the magic combination.
I have a page process that calls back end PL/SQL. I have a page item that is populated by said PL/SQL procedure, P35_PROCESSING_MSG. As you know the Process allows me to specify a message for Success and another for Failure. My desire is that, if there is a back end failure, the error will display in the dialog area, using the built-in "Process Error Message" functionality. Instead, after execution, the page item still has its default value and the following, ugly, error displays in the tabular report region.
report error:
ORA-20001: Error fetching column value: ORA-01403: no data found
ORA-06510: PL/SQL: unhandled user-defined exceptionI just don't get why it displays here instead of in the usual failure area. Moreover, I don't understand why the error is "*+unhandled+* user-defined exception" when, as you will see, I have handled it.<Jedi>These are not the errors you are looking for.</Jedi>
Anything included under a "report error" during page rendering is not displaying errors associated with a page process, but with the rendering of that report region, in this case clearly:
ORA-20001: Error fetching column value: ORA-01403: no data foundThe ORA-06510 user-defined exception error relates to this (ORA-20001 being a user-defined error), but it is coming from the APEX framework rather than your code. Often these prove to be untraceable, unrecoverable problems caused by corruption of report metadata, only "fixable" by dropping and recreating the region.
This may or may not be related to the setting of the page item "by said PL/SQL procedure", but the exceptions reported in the region are not being raised by the procedure.
What does the debug trace show to be going on?
Edited by: fac586 on 15-Aug-2012 08:35
Added "...reported in the region..." for clarity -
Hi, omniscient all!
I have a code sample where I try to request some URL from an inactive server:
declare
l_text varchar2(32000);
begin
l_text := utl_http.request('http://inactive.url:7777');
exception
when others then
declare
l_errcode number := utl_http.get_detailed_sqlcode;
begin
dbms_output.put_line(l_errcode);
dbms_output.put_line(sqlerrm(l_errcode));
end;
end;
/When I run it in Oracle SQL Developer it shows:
anonymous block completed
-12541
ORA-12541: TNS:no listenerWhen I run it in the APEX 4.0 SQL Commands window it shows:
-29263
ORA-29263: HTTP protocol error
Statement processed.The question is: why?
In real world, I need to make a HTTP POST request (no problem) and catch some exceptions. But instead of the usual ORA-12541 error APEX throws an ORA-29261 one.Any thoughts?
Maybe you are looking for
-
Data recovery after water damage
Is it possible to recover data from an iPhone after water damage, regardless of whether the phone is salvagable?
-
Synching Calendar between iPhone and Outlook 2007
When I make a calendar entry in Outlook 2007 on my PC, it automatically synchs with my iPhone through iCloud. But when I make a calendar entry in my iPhone, it does not show up in Outlook anymore. This just started about a month ago. Under settin
-
Hallo there, I would be grateful you could give me some insight into writing a dial-up connection program. Also, I'd like to know whether there are any specs on modems' api's. As if this was not enough, I was wondering whether is was possibile to see
-
How to upgrade postgres 8.1 to 8.3 on Solaris 10
My problem is that when I updade (install) Postgres 8.1 to vesion 8.3 on Solaris 10 (x86), the postgres 8.3 is well installed but The Prostgres 8.1 server is also running. and when I reboot system the Posotgres I start up with old version 8.1.
-
How to find ECC tables/ reports based on which a DB View is created?
Hi All, We have customized data source created based on a View/ Table. How can i find the ECC tables/ reports based on which this View has been created and also the logic behind which the different fields extract data from ECC.. Please advice. Than