How to get the sql if i get exception
i get this exception and dunno what was the actual sql with the bind variables that was executed.
sqlmesg =Error in select query to retrieve segment associated to cable pair: ORA-01006: bind variable does not exist
is there a way to get teh actual sql that was executed so i can find out what mistake i made.
here is my code that is causing me grief
PROCEDURE DetermineSegment( o_errorcode OUT NUMBER,
o_errortext OUT VARCHAR2,
o_segment_id_list OUT t_general_numlist ,
i_Cable IN VARCHAR2,
i_Pair IN NUMBER,
i_sysid IN NUMBER,
i_Clli IN VARCHAR2 DEFAULT NULL
IS
v_sql VARCHAR2(1000);
BEGIN
v_sql:= 'SELECT /* * */ segment_id
FROM adw_segment
WHERE Upper(TRIM(LEADING 0 FROM cable)) = :i_Cable
AND :i_Pair BETWEEN low_pair and high_pair
AND termsysid = :i_termsysid
AND provisionstatus= 3' /* find what the constant is for inservice*/ ;
IF i_COClli IS NOT NULL THEN
v_sql := v_sql || 'AND CO_Clli = :i_COClli';
END IF;
BEGIN
EXECUTE IMMEDIATE v_sql INTO o_segment_id_list
USING Upper(TRIM(LEADING 0 FROM i_Cable)),i_Pair,i_termsysid, i_COClli;
EXCEPTION
WHEN OTHERS
THEN
o_errorcode := SQLCODE;
o_errortext := 'Error in select query to retrieve segment associated to cable pair: ' || SQLERRM;
END;
END DetermineSegment;
Similar Messages
-
How can i get the SQL of a tablespace from the database
Hello All,
I am using Oracle 11g R2. I want to get the SQL of some tablespaces on my database. in the same way i get the DDL of the table using the GET_DDL function.
How can i get that ?
Regards,try this please
select dbms_metadata.get_ddl('TABLESPACE',tb.tablespace_name) from dba_tablespaces tb;or
select 'create tablespace ' || df.tablespace_name || chr(10)
|| ' datafile ''' || df.file_name || ''' size ' || df.bytes
|| decode(autoextensible,'N',null, chr(10) || ' autoextend on maxsize '
|| maxbytes)
|| chr(10)
|| 'default storage ( initial ' || initial_extent
|| decode (next_extent, null, null, ' next ' || next_extent )
|| ' minextents ' || min_extents
|| ' maxextents ' || decode(max_extents,'2147483645','unlimited',max_extents)
|| ') ;'
from dba_data_files df, dba_tablespaces t
where df.tablespace_name=t.tablespace_name Edited by: Mahir M. Quluzade on Mar 14, 2011 4:51 PM -
How to get the SQL queries based on SQL_ID.
Hi Experts,
I want to get the SQL queries based on SQL_ID.
I have tried the following query,but I am not getting full query.
[code]SET linesize 132 pagesize 999
column sql_fulltext format a60 word_wrap
break on sql_text skip 1
SELECT REPLACE (TRANSLATE (sql_text, '0123456789', '999999999'), '9', ''),sql_id
FROM dba_hist_sqltext s
WHERE s.sql_id = '7tvurftg8zryb';[/code]
One of my friend said use grid to get full query text.
Can you please help me how to use grid ,else any other method to get the full query based on SQL_ID.
Please help me.
Thanks in advance.You have these many options to set, if sql_text is really huge. But better use a tool(TOAD) as it's really helpful and easy to use instead! (See my previous comment).
column sql_text format A10000
set echo off
set head off
set feed off
set verify off
set termout off
set lines 10000
set long 1000000
set trimspool on
set pages 0
Thanks! -
How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"
How to get the SQL Signon that Agent Jobs "Run As" or "Executed as User"?
I have an install SQL scripts that creates a Linked Server. I want to put some security on the Linked Server and only grant the Agent Job Signon (the "Run As" or "Executed as User") access to the linked server. I need to retrieve the
Agent Job Signon (something like "NT SERVICE\SQLAgent$FIDEV360BI02").
I could query certain jobs and SUBSTRING the Message column - using some form of the query below, which would return "Executed as user: NT SERVICE\SQLAgent$SSDEVBI02. The step succeeded." But that is pretty imprecise.
use msdb
SELECT [JobName] = JOB.name,
[Step] = HIST.step_id,
[StepName] = HIST.step_name,
[Message] = HIST.message,
[Status] = CASE WHEN HIST.run_status = 0 THEN 'Failed'
WHEN HIST.run_status = 1 THEN 'Succeeded'
WHEN HIST.run_status = 2 THEN 'Retry'
WHEN HIST.run_status = 3 THEN 'Canceled'
END,
[RunDate] = HIST.run_date,
[RunTime] = HIST.run_time,
[Duration] = HIST.run_duration,
[Retries] = HIST.retries_attempted
FROM sysjobs JOB
INNER JOIN sysjobhistory HIST ON HIST.job_id = JOB.job_id
-- CHANGE THIS
-- WHERE JOB.name like '%GroupMaster%' or Job.name like '%etlv%'
ORDER BY HIST.run_date, HIST.run_timeby default all sql jobs are executed as sql server agent account, unless otherwise a proxy is setup.
you can get the proxy information as Olaf mentioned, if the proxy_id is null for the step, it implies that the job step was executed as sql server service account and in such case it will be null
so, if it is null, it ran as sql server agent account.
so, one work around is get the sql server agent service account and if the proxy is null, that means it ran as sql server agent account, so, use isnull function. the disadvantage would be if the sql server agent account was switched, you might not get the
accurate information as the new account will show up though the job really ran as old account, to get this information, you need to get this from the logmessage column as you mentioned above.
try this code...
/*from sql 2008r2 sp1, you get the service accounts using tsql,otherwise you have to query the registry keys*/
declare @sqlserveragentaccount varchar(2000)
select @sqlserveragentaccount= service_account
from sys.dm_server_services
where servicename like '%sql%server%agent%'
select message,isnull(name,@sqlserveragentaccount) as AccountName
from sysjobhistory a inner join sysjobsteps b
on a.step_id=b.step_id and a.job_id=b.job_id
left outer join sysproxies c on c.proxy_id=b.proxy_id
Hope it Helps!! -
How to get the SQL Execution Plan from complex Extractors ?
Hi
I am looking for a way to get the
SQL Execution Plan(s!)
from
Complex Extractors like 0CO_OM_CCA_9 ?
Anybody has got a suggestion ?
How to get this in SM50 ?
ThanXs
MartinIdentifying the query is the hard part. If you can identify it(based on table access or some such parameter, getting the execution plan is easy in ST04 .
-
How to get the SQL file name in SQL*plus
hi all,
I have created two sql file at C drive as "c:\Createtable.sql" and "c:\Deletetable.sql"
afterwards i open
C:\>sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 30 11:37:10 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter user-name: scott/tiger
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> @C:\Createtable.sql'
Table created.
SQL> @'C:\Deletetable.sql'
Table dropped.
SQL>My problem is to get the name of the file as "c:\createtable.sql" and "C:\Deletetable.sql" in sql*plus enviornment.
Thanks & Regards
SinghDear Damorgan,
>>your version number to three decimal places
My Oracle DB Version i have already stated in my previous post is 10.2.0.1.0
Actually my problem is to get the sql files name we run in sqlplus enviornment with @ symbol. like
i have created one sql file in c drive as
"C:\Createtable.sql"
afterwords i have connected to sqlplus as
sql> conn scott/tiger
sql>@c:\createtable.sql
Now i want some query to get the name of the file which is run.
In actual my problem is as
i have suppose 10 or more SQL files in some folder ( sql1.sql, sql2.sql, sql3.sql ....).
i created one file to call all the 10 sql files (main.sql)
i have also one track_table which will keep track that which sql file is runned.
I want some automated script which will insert the record in that track_table....... for that i need the name of sql file which is runned.
Hope this will help you.
Thanks & Regards
Singh -
How to get the Sql inside Omni SQL portlet.
Hi,
We are trying to find a table/view which stores/holds the Sql and Pl/Sql code of Omni Pl/sql portlets.
Thanks,
Ram.by default all sql jobs are executed as sql server agent account, unless otherwise a proxy is setup.
you can get the proxy information as Olaf mentioned, if the proxy_id is null for the step, it implies that the job step was executed as sql server service account and in such case it will be null
so, if it is null, it ran as sql server agent account.
so, one work around is get the sql server agent service account and if the proxy is null, that means it ran as sql server agent account, so, use isnull function. the disadvantage would be if the sql server agent account was switched, you might not get the
accurate information as the new account will show up though the job really ran as old account, to get this information, you need to get this from the logmessage column as you mentioned above.
try this code...
/*from sql 2008r2 sp1, you get the service accounts using tsql,otherwise you have to query the registry keys*/
declare @sqlserveragentaccount varchar(2000)
select @sqlserveragentaccount= service_account
from sys.dm_server_services
where servicename like '%sql%server%agent%'
select message,isnull(name,@sqlserveragentaccount) as AccountName
from sysjobhistory a inner join sysjobsteps b
on a.step_id=b.step_id and a.job_id=b.job_id
left outer join sysproxies c on c.proxy_id=b.proxy_id
Hope it Helps!! -
I'm new in Oracle. And I need to get the sql file of a database which already created so that I can use this sql file to create all the tables or modify some of the fields easily.
How to get started? Any recommend documents?When you install oracle 8i you will get some testing users with example tables like 'scott' user, if you install oracle 9i, you will have HR and other testing users with data and tables. You can start from there.
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96590/toc.htm -
I got an ipod touch from my friend, but can't figure out how to change the apple id to get games. Help?
Never mind, I got this.
-
on my macbook pro the hard drive icon is not on my desktop and I don't know how to find the hard drive or get the icon back on my desktop
Click on the Desktop. From the Finder menu select Preferences. Check the boxes for what you want on your Desktop. If they are already checked, then try unchecking and rechecking.
-
Getting the sql code of an expression(by Anizio)
Hi to All
I want to know if is possible get the real string sql of an expression using some class of toplink?
For example:
I have an expression "Expression ex = new ExpressionBuilder().get("CadTitular").get("titId").equal(5)"
This is equals the following sql command "select * from CadTitular where tit_id = 5"
I need get the sql value to leave an expression toplink
ThankYes, really this functioned, but help me again
I tryed with other object "InsertObjectQuery", so, the result is "null"
see the code
public static void insertObjectQuery(DatabaseSession session){
InsertObjectQuery query = new InsertObjectQuery();
Address end = new Address();
Employee empregado = new Employee();
empregado.setEmpId(new Long(560));
end.setAddressId(new Long(102));
end.setCity("Manaus");
end.setCountry("Brasil");
end.setPCode("21547");
end.setProvince("CN");
end.setStreet("AV.");
end.addEmployee(empregado);
query.setObject(end);
query.dontCascadeParts();
DatabaseRow row = new DatabaseRow();
query.prepareCall(session, row);
String sql = query.getTranslatedSQLString(session, row);
System.out.println("VALOR DE STRING SQL: " + sql); //print null
session.executeQuery(query);
} -
Get the SQLs In between a date range
Get the SQLs irrespective of sessions in the order of its execution from a specified schema with in a date time range
Which version of Oracle are you using?
Jaffar -
How long does the process take to get a nano repaired or replaced?
how long does the process take to get a nano repaired or replaced?
Windows XPUsually just a few days... they very seldom (if ever) repair them. You'll usually get either a new or refurbished replacement.
-
How to view the sql query?
hi,
how to view the sql query formed from the xml structure in the receiver jdbc?You can view SAP Note at
http://service.sap.com/notes
But you require SMP login ID for this which you should get from your company. The content of the notes are as follows:
Reason and Prerequisites
You are looking for additional parameter settings. There are two possible reasons why a feature is available via the "additional parameters" table in the "advanced mode" section of the configuration, but not as documented parameter in the configuration UI itself:
Category 1: The parameter has been introduced for a patch or a SP upgrade where no UI upgrade and/or documentation upgrade was possible. In this case, the parameter will be moved to the UI and the documentation as soon as possible. The parameter in the "additional parameters" table will be deprecated after this move, but still be working. The parameter belongs to the supported adapter functionality and can be used in all, also productive, scenarios.
Category 2. The parameter has been introduced for testing purposes, proof-of-concept scenarios, as workaround or as pre-released functionality. In this case, the parameter may or may not be moved to the UI and documentation, and the functionality may be changed, replaced or removed. For this parameter category there is no guaranteed support and usage in productive scenarios is not supported.
When you want to use a parameter documented here, please be aware to which category it belongs!
Solution
The following list shows all available parameters of category 1 or 2. Please note:
Parameter names are always case-sensitive! Parameter values may be case-sensitive, this is documented for each parameter.
Parameter names and values as documented below must be used always without quotaton marks ("), if not explicitly stated otherwise.
The default value of a parameter is always chosen that it does not change the standard functionality
JDBC Receiver Adapter Parameters
1. Parameter name: "logSQLStatement"
Parameter type: boolean
Parameter value: true for any string value, false only for empty string
Parameter value default: false (empty String)
Available with: SP9
Category: 2
Description:
When implementing a scenario with the JDBC receiver adapter, it may be helpful to see which SQL statement is generated by the JDBC adapter from the XI message content for error analysis. Before SP9, this can only be found in the trace of the JDBC adapter if trace level DEBUG is activated. With SP9, the generated SQL statement will be shown in the details page (audit protocol) of the message monitor for each message directly.
This should be used only during the test phase and not in productive scenarios.
Regards,
Prateek -
How to identify the SQLs which are using the tables and new columns
Hi
I m using oracle 10G Database in windows. Developers have added some columns in some of the database tables and were asking to check whether there is some impact on performance or not. I have not done this performance tuning before. Kindly help me how to proceed further.
How to obtain the sqls which are touching the tables and the new columns? It would be really great if you can help me with this.
ThanksYou can try to use DBA_DEPENDENCIES to get PL/SQL objects using tables: http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_1041.htm#i1576452.
However if SQL code is not stored in database in a trigger, a procedure, a function, a package or a view, it is impossible to retrieve all SQL code referencing some table from database dictionary: for this you would have to analyze application source code.
Maybe you are looking for
-
"This file does not appear to be a Photoshop file"
Ok, I used the first edition of Encore in the past, but I just installed the version that came with Premiere CS3. I used Photoshop 6.0 to do my menus in the past, but just installed the trial of Photoshop CS3. Two things: My old menus I created in Ph
-
where can i download a working version of Facetime. I was having problems with mine and I deleted it. Now it won't let me re-install it from the app store.
-
I received a message saying I must change my iCloud pass code keychain due to changes in the server. Is this a hoax?
-
No increase in file transfer speed?
AEBS n connected as a wireless bridge, all networks showing up. IMAC is wired to Linksys router and AEBS is ethernet connected to Linksys. I don't get any increase in speed in transferring files over the network between an IMAC and Macbook which are
-
Adding Rules - How to Make More Simple???
Hello - I am a big fan of RULES and have many to add to my new PowerBook G4. When I was on MS Outlook, I used to click on rules from an e-mail, and the program would guess that it was "that" particular sender that I wanted to add to the rule. Is ther