How to get the SQL Statement of a report region?

For example: The SQL of report region such as "SELECT A,B,C FROM T1 WHERE A = :P10_A".
I hope to get the converted statement (the variable has been replaced), like this:
:P10_A = 'TOM', SQL: "SELECT A,B,C FROM T1 WHERE A = 'TOM'".
THX.

I agree with John with the usual caveat about using bind variables.
In other words, you should use
SELECT A,B,C FROM T1 WHERE A = :P10_Ainstead of SELECT A,B,C FROM T1 WHERE A = 'foo'so that the shared pool doesn't get clutterred with copies of the same (sharable) SQL.
Even if you use the "PL/SQL function returning a SQL query", be sure to use bind variables in your SQL and not "glue in" session state by concatenating it into the query.
Thanks.

Similar Messages

  • How to get the SQL statement

    I cannot figure how to get the text(SQL statement) from a system view(i guess it is in a system view... but witch??). 'Till now i have the sql_address and the sql_hash_value..
    I know it is possible.. EM does it ... so i should be able to do the same..
    ps:I use 9.2

    v$sql ?

  • How to get a SQL statement that trigerred a trigger ?

    I'd like to trace all insert and update operations done on a table.
    So, how can I get the SQL statement that triggered a trigger ?
    Thanks

    Use AUDIT to trace all sql statement about table, views etc. (except column) :
    http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10759/statements_4007.htm#SQLRF01107
    Or, if you are in 9i or later, you can use DBMS_FGA (you can audit just a column) :
    http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10802/d_fga.htm#ARPLS015
    Nicolas.

  • How to get the previous state of my data after issuing coomit method

    How to get the previous state of some date after issuing commit method in entity bean (It should not use any offline storage )

    >
    Is there any way to get the state apart from using
    offline storage ?As I said the caller keeps a copy in memory.
    Naturally if it is no longer in memory then that is a problem.
    >
    and also what do you mean by auditlog?
    You keep track of every change to the database by keeping the old data. There are three ways:
    1. Each table has a version number/delete flag for each record. A record is never updated nor deleted. Instead a new record is created with a new version number and with the new data.
    2. Each table has a duplicate table which has all of the same columns. When the first table is modified the old data is moved to the duplicate table.
    3. A single table is used which has columns for 'table', 'field', 'data' and 'activity' (update, delete). When a change is made in any table then this table is updated. This is generally of limited useability due to the difficulty in recovering the data.
    All of the above can have a user id, timestamp, and/or additional information which is relevant to the data being changed.
    Note that ALL of this is persisted storage.
    I am not sure what this really has to do with "offline storage" unless you are using that term to refer to backed up data which is not readily available.

  • 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_time

    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!!

  • How to put the SQL-statement returned value into the field (as a default)

    Hi,
    I am using Developer/2000 (Forms Designer) under windows 98.
    Please tell me how to put the SQL-statement value (as a default value) into the field before enter-query mode. Noted that I have tried the following ways but still some problems:-
    1) Place the SQL-statement into PRE_QUERY trigger in the form/block level.
    There is a message box which ask 'Do you want to save the changes?'.
    2) Place the SQL-statement before execute enter_query. There is still a
    message box which ask 'Do you want to save the changes?'.
    Any hints? Thanks. Urgent.

    solved it!
    1) Suppress DEFAULT save message
    if form_failure then
    raise form_trigger_failure;
    end if;
    2) Place the default value before enter-query.
    Ref: Title='Default value in query field in ENTER_QUERY mode' in designer forum by CVZ
    form level trigger
    ============
    WHEN-NEW-ITEM-INSTANCE
    =======================
    if :system.mode = 'ENTER-QUERY' then
    :block.item := 'default waarde';
    end if;
    3) Suppress the changes whenever leaving the default field.
    if :block.item is null then
    -- assign statement
    end if;

  • How to write the sql statement of my finder function in cmp?

    hi,
    I create a cmp ejb from table INFOCOLUMN,and I create a my finder function ,which sql statement is :
    select * from INFOCOLUMN WHERE employee_id=id
    employee_id is a column of the table,and id is the finder function parameter.
    The error is : invalid column name
    So,how to write the sql statement.
    Thanks .

    Mole-
    Bind variables are of the form $1, $2, etc., so your query stmt should look like:
    select * from INFOCOLUMN WHERE employee_id=$1
    -Jon

  • Get an set the SQL statement from a report at runtime

    i know there is an opportunity to filter the records by using setRecordSelectionFormula() method...but i wondered if you can anyhow get the whole SQL statement that is in the report. i think it would be very useful for many developers to maipulate the SQL directly like you were able to using the PE-functions in the old CRPE32.DLL...
    but in CR XI the CRPE32.DLL is no longer supported. now we have to substitute these functions with the JRC but i am not sure if it provides everything we had in the CRPE32.DLL...
    after all i do not understand why the CRPE32.DLL is still delivered but not supported. in my CR XI R2 installtion i found this file signed with version 11.5.3.438
    by the way it is a question of performance...a query would be faster if you could directly query the database by changing the reports sql statement instead of allowing the report to retrieve all data and then performing the filtering.
    so please, for the next version of the JRC give us the opportunity to get an set the sql statement of a report directly!

    Not an option. crpe32 is proprietory and the SQL we generate is to complex to assume it will be done correctly. Which is why the ability was removed

  • How to get  the actual data in ALV report

    I am doing some upgradation work   in that i am using Submit  & And return and  also i am using some function modules like LIST FROM MEMORY , LIST TO TXT wnd WRITE LIST , it gives output in normal list format , But i need to print in ALV report .
    With the use of set table for 1st display i got the  ALV report   but not with actual data, (some junk value is showing) , So can any 1 suggest me how to get  the  actual data in ALV report, With the use of  Any Function Module or with Coding,
    with regards,

    Hi Saravana
    I am sure you must be getting the values in tables of table parameters from every FM.
    consolidate the values from tables of all FMs in one table and built ALV for that table only.
    I hope this way you can show the actual data in ALV.
    thanks
    Lalit

  • How to get the original version of Web report in BW ?

    Hello Friends ,
    I have transported one Web report from BW development to BW Production System.
    But unfortunately , the desired result not me met .
    So I have been asked to keep the original version of the Web report.
    As the new version of Web report has replaced the previous one ,
    So could anybody tell me how to get the original version of Web report in BW ?
    Many thanks in advance !!!!!!!!

    Hi,
    You can use the Transaction STMS choose the option "Import Overview" . In the GOTO tab select "History" and choose "Import History".
    Here you can find the history of requests imported to the prod system.
    Regards,
    K.Manikandan.

  • How to get the total pages in ALV report?

    Hi guys,
    Since I used page breaks can somebody please help me on how to get the total pages in ALV report?sincerely please...thanks guys.

    automatic display total page.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    r

  • How to get the sql which executing?

    I want to know the query sql runing in timesten? how can I get it?
    For example, in oracle 9i we can use below sql to get the query sql runinig in oracle.
    1.select OSUSER, PROGRAM, USERNAME, SCHEMANAME, B.Cpu_Time, STATUS, B.SQL_TEXT
    2. from V$SESSION A
    3. LEFT JOIN V$SQL B ON A.SQL_ADDRESS = B.ADDRESS
    4. AND A.SQL_HASH_VALUE = B.HASH_VALUE
    5. order by b.cpu_time desc
    thanks!

    Sorry, there is no way to get this information in TimesTen. You can use internal tracing to see each SQL statement as it is executed but (a) the performance hit is severe and (b) there is no timing or CPU usage information available.
    If you want to know how long a specific SQL statement takes to execute you need to add timing instrumentation to your application code.
    Chris

  • 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 view the SQL statement generated during execution of the BW Query?

    Dear Experts,
    I am trying to retrieve data in a SAP BW Query from a Non-SAP system.
    I think if I am able to see the complete SQL statement that was generated when I executed the BW Query, I may be able to use it to retrieve the data.
    Do you know how and where I can see the SQL statement of a BW Query's SQL statement?
    I tried RSRT options to execute the Query but still could not find the SQL statement.
    Thanks in advance.
    Regards,
    Shunhui.

    hi
    goto rsrt
    give your query name
    select execute + debug option
    in the debug option under data manager check the check box "display SQL/BIA query
    selcet continue
    you can see the sql statement
    thanq

  • How to isolate the Sql Statement from Java Code

    Hi
    I Need to know that can we segregate the Sql Statements and convert them to Stored Procedures so as to isolate the Sql statements from Java Code.
    So i have one static web page which uses four select Statements so what i want is to create a stored procedure encapsulating these queries. So that the Java Web Developer will simply call the Stored Procedure instead of using four different SQL Statements.
    Suppose the developer has these four Statements
    Select ename,empno,sal,job from emp;
    select empno,ename,mgr from emp;
    select deptno,dname from dept;
    select emp.ename,emp.empno,emp.deptno,dept,dname fromemp,dept;
    So can i encapsulate these four Sql Statements in one Procedure and the Web developer can call the Store procedure and dont need to write the Sql Statements in his code.
    Can Anybody guide me how to write this Stored type of Store procedure.
    Thanks

    http://www.google.com/search?q=java+windows+registry
    Next time, search yourself. It might be beyond your belief, but you're really, really not the first person to wonder about this.

Maybe you are looking for

  • Crazy iCal - doesn't show any events and to-dos

    My iCal is going crazy. It all started with an inspector popup not closing. I clicked on "Done", but it just stayed there. I switched to a different week, it stayed at its position. I closed the window, it disappeared, but when I reopened the popup i

  • Arithmetic Conversion error in routine

    Hi All, We are trying to load data till PSA in Production system. Load fails due to the following error. *"ARTHIMETIC CONVERSION ERRORIN ROUTINE_002"* Can somebody help on this. Regards, Sudha.

  • Help with replacing special characters and how/where to put the javascript...

    Hey there A while ago I added javascript to some parts of my PDF around the use of dates and phone numbers, I now have Acrobat 11, and I am at a loss of how to add a new javascript (i cant remember at all) the code I have is if (!event.willCommit) {

  • What is icloud good for?

    I don't quite get it... What is icloud really good for? And why should I prefer it to Dropbox?

  • Nokia E52 email issue since firmware upgrade (031....

    Hi guys, Yesterday i successfully upgraded my E52 to latest firmware - 031.012. After upgrade i removed all previous email accounts (1 MFE, 1 pop and 1 imap) and start a new setup. i have to mention, that i double checked that the email client versio