I can capture the SQL statement cuasing a mistake?
I have an error log this capures SQLCODE & SQLERRM.I can also capture the statement real SQL causing the error?
There is also size stack of calls, stack format error and size error backtrace.
/* Formatted on 6/21/2011 3:45:40 PM (QP5 v5.149.1003.31008) */
BEGIN
FOR c IN (SELECT TO_NUMBER ('hey Im not a number') FROM DUAL)
LOOP
NULL;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.PUT_LINE ('SQLCODE :' || SQLCODE);
DBMS_OUTPUT.PUT_LINE ('SQLERRM :' || SQLERRM);
DBMS_OUTPUT.
put_line (
'call stack...' || CHR (10) || DBMS_UTILITY.FORMAT_call_STACK ());
DBMS_OUTPUT.
put_line (
'Error_Stack...' || CHR (10) || DBMS_UTILITY.FORMAT_ERROR_STACK ());
DBMS_OUTPUT.
put_line (
'Error_Backtrace...'
|| CHR (10)
|| DBMS_UTILITY.FORMAT_ERROR_BACKTRACE ());
DBMS_OUTPUT.PUT_LINE ('----------');
RAISE;
END;
SQLCODE :-1722
SQLERRM :ORA-01722: invalid number
call stack...
----- PL/SQL Call Stack -----
object line object
handle number name
c0000002a56b4248 11 anonymous block
Error_Stack...
ORA-01722: invalid number
Error_Backtrace...
ORA-06512: at line 2
----------
Tags: Database
Similar Questions
-
Capture the SQL statement before it runs
Hello world
I have a question about the capture of query sql statement in Oracle before he run? Is it possible to do and can give you the answer to this problem? Enter here means I can catch the declaration of all applications (like SQL, I * sqlplus or another application making the request to the database). I want to do this because my teacher asks me to analyze the request and if it violates any policy = > stop before Oracle run it.
I tried this solution
[Select trigger for Oracle | http://technology.amis.nl/2005/09/26/select-trigger-in-oracle-database-introducing-fine-grained-auditing/].
but I think he looks not the answer. Because for the audit of the refined, the event handler is called when the first row is obtained. This is the average Oracle a analyze this quere and run to get the first row.
Please help me with this problem
Edited by: pirent420 at 04:05 06/05/2012Hello
That's what you ask...www.Oracle.com/technetwork/Products/Database-Firewall/index.html
Some other related things are:
the database Vault control many things related to this in terms of what time of the day and access where data etc.
Resource Manager can block statements if they want to use too many resources.
The standard model of privilege/role/grant prevents access you something, that you are not allowed to see.
Views can hide columns if necessary.
DTV and RLS can hide lines
It depends exactly on the requirement.
See you soon,.
Harry -
How can I pass a condition of the table in the sql statement?
For example, in the table in the COND Varchar2 column (200) there is the value ' VAR > 10'.
| COND |
|' VAR > 10' |
where VAR is the name of the table column. I would like to make statement CASE WHEN VAR > 10 AND 0... I tried with as subquery
WHEN BOX (SELECT COND FROM TABLE WHERE...) THEN 0, but it does not work.
Hello
You can do this by using dynamic SQL.
that is to say:
declare v_stm varchar2(4000); v_cond varchar2(100); v_result integer; begin select cond into v_cond from yourtable where a=1; v_stm := 'select case when '||v_cond||' then 0 ...'; -- dynamic sql execute immediate v_stm into v_result; end; /
Remember that, in general, dynamic SQL has a performance degradation that SQL static and should be avoided when possible.
Storage condition or the SQL statements in the tables is not a good practice.
Kind regards.
Alberto
-
Determine the SQL statement from a trigger
Hello
I currently use triggers to write in an array of history/log.
Is there anyway of the determination of the trigger - the actual sql statement that fired the trigger?
Rob.This can help...
CREATE OR REPLACE TRIGGER EMP_TRG1 BEFORE UPDATE ON EMPLOYEES declare v_num NUMBER; sql_stmt varchar2(2000); sql_text ora_name_list_t; BEGIN v_num:=ora_sql_txt(sql_text); FOR i in 1..NVL(v_num,0) LOOP sql_stmt:=sql_stmt||sql_text(i); END LOOP; INSERT INTO EMP_LOG VALUES(sql_stmt); --dbms_output.put_line(sql_stmt); END;
Re: capture of sql statement that activates the trigger
Re: Get the text of the query to a trigger -
Identify the SQL statements that are executed frequently
I would like to identify SQL statements that are executed may times (e.g., > 1000 times) during an interval AWR.
I am aware of coloring a SQL_ID with exec ('...') dbms_workload_repository.add_colored_sql; but then the SQL ID must be known.
Is it also possible to do the same for the (not yet known) SQL statements that are executed > 1000 times? I think that the SQL statements that run very quickly (for example 1 s <) won't be captured automatically in a CWA even if those statements are frequently performed.
Version 11.2.0.4 on SLES11
Try this...
fixed lines 155
execs from collar to 999 999 999
Col min_etime to 999,999.99
Col max_etime to 999,999.99
Col avg_etime to 999,999.999
Col avg_lio to 999,999,999.9
Col norm_stddev to 999,999.9999
Col begin_interval_time to a30
node of col to 99999
break on plan_hash_value on startup_time skip 1
Select * from)
Select sql_id, sum (execs), min (avg_etime) min_etime, max (avg_etime) max_etime stddev_etime/min (avg_etime) norm_stddev
de)
Select sql_id, execs, plan_hash_value, avg_etime,
StdDev (avg_etime) on stddev_etime (sql_id partition)
de)
Select sql_id, plan_hash_value,.
Sum (NVL(executions_delta,0)) execs,
(sum (elapsed_time_delta) /decode (sum (nvl(executions_delta,0)), 0.1, sum (executions_delta)) / 1000000) avg_etime
-sum ((buffer_gets_delta/decode (nvl(buffer_gets_delta,0), 0.1, executions_delta))) avg_lio
DBA_HIST_SQLSTAT s, DBA_HIST_SNAPSHOT SS
where ss.snap_id = S.snap_id
and ss.instance_number = S.instance_number
and executions_delta > 0
Group of sql_id, plan_hash_value
)
)
Group of sql_id, stddev_etime
)
where norm_stddev > nvl (to_number('&min_stddev'), 2)
and max_etime > nvl (to_number('&min_etime'),.1)
order of norm_stddev
/
-
Get the SQL statement error programmatically
Hello
error SQL in the FORMS, you can display the erroneous SQL statement pressing (shift) (Ctrl) E on the screen. Is there a way to get the text of the SQL statement in a PL/SQL function for logging purposes?
I get the error using SQLERRM, it's not a problem. But how can I get the SQL text of the statement?
Thanks and regards,
Sascha
Sascha,
You should be able to use the: SYSTEM. System LAST_QUERY variable forms.
Craig...
-
How to analysis of the XML in the sql statement?
Hi friends, I have a table that contains a column of type CLOB, stores in xml format. For example, the data are like that
<Employees xmlns="http://TargetNamespace.com/read_emp"> <C1>106</C1> <C2>Harish</C2> <C3>1998-05-12</C3> <C4>HR</C4> <C5>1600</C5> <C6>10</C6> </Employees>
So how can I write the sql statement for the analysis of the data at the top
create or replace procedure parsing_xml
(
clob trans_payload
trans_dir varchar2
)
as
Start
if(trans_dir='inbound/emp')
then
insert into emp_proj
(
employee_id
last_name
hire_date
job_id
salary
department_id
)
Select t1.c1
t1.c2
t1.c3
t1.c4
t1.c5
t1.c6
from xmltable
(
XmlNamespaces ('http://TargetNamespace.com/read_emp' as 'emp').
' / ' emp:Employees by the way of xmltype (trans_payload)
columns
whole path of C1 'emp:C1. "
path of varchar2 (10) C2 'emp:C2. "
C3 varchar2 (10) path "emp:C3."
C4 varchar2 (10) path "emp:C4."
whole path of C5 "emp:C5."
C6 varchar2 (10) path 'emp:C6 '.
) t1;
end if;
commit;
end;
-
CALL THE PROCEDURE IN THE SQL STATEMENT
Why we cannot call a procedure inside the SQL statement?Hello
Usually when you select an item should return you data. In the case of a procedure, you cannot return any return value from the procedure directly it has to be done through some settings and to access these settings, you cannot use a simple sql statement. Where as in a function, you must return one of data that can be easily obtained accordingly.
see you soon
VT
-
Tuning sql of a product to the seller without changing the sql statement
Hello
We have a product of the provider that generates the SQL statement. For a query, we get the answer in 15 seconds. But users are asking if we can bring it back to 5 seconds. Limitation is the query can not be changed. He used about 10 to 12 tables and bit complex query.
What kind of options could be evaluated if we are to improve the performance of a query (not sure if she could never be reduced to 5 seconds)
without making any change to the query.
Database Version: Oracle 10.2.0.4
Thank you
DelphineHello
http://www.Oracle-base.com/articles/10G/AutomaticSQLTuning10g.php
your software is enterprise or standard?
Tuning Pack & pack diagnosis are extra cost option with the standard edition.
& the useful note * automatic SQL Tuning - SQL [271196.1 ID] profiles *.
http://www.Oracle.com/us/corporate/pricing/technology-price-list-070617.PDF
Thank you
Published by: CKPT November 5, 2010 11:12
-
the SQL statements used to create views
Hello
How can I see the full text (with table) to create a sql view:
Thank you.SQL> select text from dba_views where rownum=1; TEXT -------------------------------------------------------------------------------- select "LIB_IDX","LIB_NAME","VENDOR_NAME","PROTOCOL_NUM","VERSION_NUM","PATH_NAM
Try the following in the SQL * faster before executing the SQL statement:
SET LONG 1000
If this does not work, increase it if necessary.
-
How to execute the SQL statement in the Application Module
Hi people
I´d would like to know how I can execute a SQL statement like "remove user" in the Module to request... prepareSession method...
I m using Jdev 10 with ADF Faces
Thank youThis is possible, but you should think twice about it.
If this can be done with an EO/VO do in this way.
If you can't do it with an EO/VO you can yourself the DB operation (ApplicationModule.getDBTransaction ()) and use a call of createStatement (...) do what you want.Timo
-
Why the sql statement was extucted twice in shell script?
I tried to test the rac load balancing using the shell script depending on suse 10 + oracle 10g rac.
After run the shell script, I got the result to follow.oracle@SZDB:~> more load_balance.sh #!/bin/bash for i in {1..20} do echo $i sqlplus -S system/oracle@ORA10G <<EOF select instance_name from v\$instance; / EOF sleep 1 done exit 0
Seem that the sql statement was run twice in each loop. If you help please take a look. Thanks in advance.oracle@SZDB:~> ./load_balance.sh 1 INSTANCE_NAME ---------------- ora10g2 INSTANCE_NAME ---------------- ora10g2 2 INSTANCE_NAME ---------------- ora10g1 INSTANCE_NAME ---------------- ora10g1 3 INSTANCE_NAME ---------------- ora10g1 INSTANCE_NAME ---------------- ora10g1
RobinsonBecause you have one; and one.
-
copy and paste the sql statement into sql * more
How do you paste the sql statement into sql * more... I tried the following options, get the windows interface for this sequel to the documentation below, but that did not work
http://download.Oracle.com/docs/HTML/A88829_01/ch3.htm
then I tried to create a simple .txt file with my sql statement and tried to run using @name (where name is the name of the file) and it gives me the following error SP2-0310: cannot open the file 'firstscriot.sql '.You name the file name.txt? Then you cannot start with @name, because SQL * PLUS will add the extension .sql
Try instead the @name.txt or name the file name.sql
And check if you have the correct path.
Concerning
Marcus -
In an interview, no one asked me a question. How the sql statement
ex: select * from emp;
I answered him as if the select statement is in the library cache then it will retrieve data from the cache, otherwise it will retrieve data from database files. On this, he asked to go. I could not years itself. Anyone like elobarate me on the analysis?SMON,
I would have preferred the official documents from Oracle, as suggested by
http://download.Oracle.com/docs/CD/E11882_01/server.112/e16508/sqllangu.htm#CHDFCAGA
Concerning
Peter -
Need help to resolve the error - below the SQL statement to execute cannot be
Below is my CO as, which creates a callable statement.
try {}
OAApplicationModule oaapplicationmodule = (webBean) pageContext.getApplicationModule;
OADBTransactionImpl t = (OADBTransactionImpl) oaapplicationmodule.getOADBTransaction ();
OracleCallableStatement proc = (OracleCallableStatement) t.createCallableStatement (lquery,-1);
proc. Execute();
t.Commit ();
}
catch (SQLException sqlexception)
{
throw OAException.wrapperException (sqlexception);
}
After the execution of the page, get the below error... (Please find below stack error)
I have referred the development guide but did not get something useful.
Please give me clues about the same.
Raghu cordially
-- Error Stack ---------------------------------------------------------
Error page
Details of the exception.
oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: Houston-27123: SQL error in the preparation of the call statement. Statement: null
at oracle.apps.fnd.framework.OAException.wrapperException(OAException.java:888)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(OAPageErrorHandler.java:1145)
at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(OAPageErrorHandler.java:1408)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2637)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
in OA. jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
# # 0 in detail
java.sql.SQLException: the SQL statement to execute cannot be empty or null
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
in OA. jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
java.sql.SQLException: the SQL statement to execute cannot be empty or null
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
at oracle.jdbc.driver.OracleConnection.privatePrepareCall(OracleConnection.java:1138)
at oracle.jdbc.driver.OracleConnection.prepareCall(OracleConnection.java:1054)
at oracle.jbo.server.DBTransactionImpl.createCallableStatement(DBTransactionImpl.java:3033)
at cisco.oracle.apps.xxchr.element.server.webui.XXCHRElementSetSearchCO.processFormRequest(XXCHRElementSetSearchCO.java:343)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:799)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processFormRequest(OAPageLayoutHelper.java:1118)
at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processFormRequest(OAPageLayoutBean.java:1579)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processFormRequest(OAFormBean.java:395)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:995)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequestChildren(OAWebBeanHelper.java:961)
at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processFormRequest(OAWebBeanHelper.java:816)
at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processFormRequest(OAWebBeanContainerHelper.java:363)
at oracle.apps.fnd.framework.webui.beans.OABodyBean.processFormRequest(OABodyBean.java:363)
at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(OAPageBean.java:2633)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1659)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497)
at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418)
in OA. jspService(OA.jsp:40)
at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:317)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:465)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:379)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:727)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:306)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:767)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:259)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:106)
to EDU.oswego.cs.dl.util.concurrent.PooledExecutor$ Worker.run (PooledExecutor.java:803)
at java.lang.Thread.run(Thread.java:534)
Published by: Rambeau on Oct 14, 2010 02:58check the code stuck by me again
Connection Conn = pageContext.getApplicationModule (webBean) .getOADBTransaction () .getJdbcConnection ();
Connection conn = oaapplicationmodule.getOADBTransaction().getJdbcConnection(); //Right one
Thank you
-Anil
Maybe you are looking for
-
I forgot my security question I can't change my account information
I forgot my security question now what am I
-
Update album artwork, but then always change in return.
OK so I have several works of the album that update very well, but then as soon as a few seconds they change back. I think I just do: I remove the work of old in the section to read the information, select my new and I do this for every song in the a
-
How to delete photos in my profile?
When I go to "recent photos" in "change photos" in my profile, I am presented with a lot of pictures which I won't use or have available. How can I remove the unwanted?
-
How to check the power of the signal to an extended airport
I have 2 Airport extreme. (new 802.11ac versions) We're at the bottom, connected to a cable modem, and the other is implemented as an extension to the floor. 6.3.6 Airport utility I can click on a base station and place the cursor on a connected clie
-
It doesn't damage the laptop if I always use alternating current with battery on?
I have a laptop G7-2017 us and always use whith the power supply, I never move office. I noticed that the battery is exhausted even if voltage AC. Does it damage the battery if I use it always with the ca, the battery must be removed and stored?