How to get logging sql query error

Hi,
I want to create some constraints and indexes on tables on a particular schema and I have the script to build the indexes and constraints.
But I want to get the errors that should be logged on some file during indexes and constraints creation.
Pls help me...
Thanks in advance..

If you are running the script via SQLPlus then just add a "spool filename" to the beginning of the script and a "spool off" at the end so that query results are written to the file. Also you probably want to "set echo on" at the beginning so that the SQL statements are written to the file also.
See the SQLPLus Users Guide for the set command and spool.
HTH -- Mark D Powell --

Similar Messages

  • How to get physical SQL query

    Hi All,
    How to get the physical SQL query for the OBIEE reports.
    Thanks in advance,
    Haree.

    Hi Anitha,
    Thanks for your reply,
    I am getting XML script in log file. (Settings > Administration > Manage Sessions > View Log).
    How to get physical SQL query ?
    Thanks,
    Haree

  • How to get an sql query result to a textbox?

    i am working with jdk1.4 and office 2003.
    i need to run the following SQL Query: "SELECT max(BookId) as BookId FROM Books" where BookId is an autonumeric generated number obtained from the field autonumber in access 2003 database.
    now, the result of this must be placed in a textbox.
    does anyone knows how to do this?
    I ve tried this but nothing happens and niether any error comes
    st = con.createStatement ();     //Creating Statement Object.
    long bookNo;          //Use for Comparing the Book's Id.
    try {     //SELECT Query to Retrieved the Record.
    String q = "SELECT max(BookId) as BookId FROM Books";
    ResultSet rs = st.executeQuery (q);     //Executing the Query.
    bookNo = rs.getLong ("BookId");          //Storing the Record.
    bookNo =(bookNo+1);
    txtBookId.setText (""+bookNo);
    catch (SQLException sqlex) { }
    does anyone knows how to do this?????plz help me out.
    Thanks
    Aanchal

    Hi Aanchal,
    If an SQL error occurs now, you cannot see it in your code. You should do something with the exception you catch, e.g. printing it: sqlex.printStackTrace(), so that you can see if something goes wrong.
    For your number, you should move the cursor in the resultset to the first row - either by: calling first( ) or next ( ), then you can retrieve your booknumber.
    Best Regards,
    Martijn

  • How to get the SQL Query statement of a Search Form ?

    Hi all,
    We have a requirement to send the query result of an ADF Search Form into report application (Crystal rpt).
    Crystal can accept data source as query statement. SO I think of getting the exact query statement "generated" by the ADF Search form and send it to crystal.
    Is this possible ?
    Thank you very much,
    xtanto

    Try the various get methods of the viewObject such as getQuery:
    http://www.oracle.com/webapps/online-help/jdeveloper/10.1.2/state/content/navId.4/navSetId._/vtAnchor.getQuery%28%29/vtTopicFile.bc4jjavadoc%7Crt%7Coracle%7Cjbo%7CViewObject%7Ehtml/

  • How to get the sql query result?

    Hi,
    Currently I am using LV2012 to connect a Oracle database server. After the installations/settings for Oracle Express and Oracle ODBC driver done.
    I am sucessfully to use the SQL command to query the data through my window command prompt. 
    Now the problem is, how I do the same task in Labview by using the database connectivity toolkits?
    I have build a VI for query as attached, but i have no idea what pallete to use to get the query result.
    Please help me ~~
    Solved!
    Go to Solution.
    Attachments:
    Query.vi ‏9 KB

    Here is a piece of code I use to test SQL commands, you can use the part that retrieves sql results.
    It is also possible to get the column headers back, but that is for next lesson!
    Attachments:
    RunSQLCommand.vi ‏30 KB

  • How to get this sql query value in oracle query?

    Hi all,
    i am using one query in sql that is
    select @EarlyLeaversMin = DATEDIFF(Minute,@OutTime,@nshiftmax)
    suppose first line query is getting 60 minutes.
    select @EarlyLeaversMin1=DATEDIFF(Minute,@temphrs,@ShiftTime)
    second line query is also getting 60 minutes
    set @EarlyLeaversMin=@EarlyLeaversMin+@EarlyLeaversMin1+1
    and now here it's calculating both variable minutes and storing in @earlyleaversmin that should store like 60+60+1=121 mintes
    select @EarlyLeaverstimeformat = CONVERT(char(8),Dateadd(n,@EarlyLeaversMin,0),108)
    so now it will store in this query that value in this format : 01:21:00
    can i use the same which it's happening here??
    thanks

    Oracle handles dates and time very differently from SQL Server (as I gather others on this forum have already tried to explain to you).
    Anyway, Oracle does not have a TIME datetype, but what it does have are INTERVALs. In this case you would use INTERVAL DAY TO SECOND. It's not completely clear what you mean by "store in this query that value" but we can use INTERVALS as both table columns and PL/SQL variables.
    So your first query would be something like this:
    declare
        interval_var  INTERVAL DAY TO SECOND;
    begin
         select (nshiftmax - outtime) day to second
         into interval_var
         from whatever;We can do arithmetic with interval variables.
         select (nshiftmax - outtime) day to second +  (shifttime - temphrs) day to second
         into interval_var
         from whatever;To add a hard-coded interval such as 1 minute you can use this functionality:
         interval_var := interval_var + to_dsinterval('0 0:1:0');There's loads of info in the Oracle documentation. [url http://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements001.htm#sthref115]Find out more.
    Cheers, APC

  • How to get report (SQL Query) generating Run Time

    There is a Standard report of Payroll which show employee transfer information on the bases of location, grade job or organization, now to get actual query which is generated by run time in report builder including whether single column parameter or lexical parameter " because currently the query in not complicate but the parameter and lexical parameter is much more due to this not quite easy to under stand just copy past it into toad or pl/sql developer,
    Kindly share your experience to get such kind of query in you working time.
    thanks

    Here i try to explain contain of query.
    Parameter
    P_DEPTNO = 10
    P_WHERE_CLAUSE := ' AND EMPNO IS NOT NULL AND SALARY > 100'
    SELECT * FROM EMP
    WHERE DEPTNO = P_DEPTNO
    &P_WHERE_CLAUSE
    REPROT WILL GENERATE QUERY AT RUN TIME IS LIKE THAT
    SELECT * FROM EMP
    WHERE DEPTNO = 10
    AND EMPNO IS NOT NULL AND SALARY > 100
    Now i want to get this query out(Run time) by doing any oracle database feature or sth similar.
    thanks

  • How to get running SQL query 2008r2

    Hi
    I am faultfinding multiple slow queries initiated by SharePoint 2010 crawls.
    Is there any way in SQL management studio where i can display the current running queries?
    I'd love to get my hands on the queries running:P
    brgs
    Bjorn

    I use Adam's great utility
    Who Is Active? v10.00 (2010-10-21)
    (C) 2007-2010, Adam Machanic
    Feedback: mailto:[email protected]
    Updates: http://sqlblog.com/blogs/adam_machanic/archive/tags/who+is+active/default.aspx
    "Beta" Builds: http://sqlblog.com/files/folders/beta/tags/who+is+active/default.aspx
    License: 
    Who is Active? is free to download and use for personal, educational, and internal 
    corporate purposes, provided that this header is preserved. Redistribution or sale 
    of Who is Active?, in whole or in part, is prohibited without the author's express 
    written consent.
    BTW http://dimantdatabasesolutions.blogspot.co.il/2008/06/how-do-you-maintain-sharepoint.html
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • HOW TO FIND AND CORRECT THE SQL QUERY ERRORS ????

    Sometimes I get the errors while executing the sql queries.
    I just wanted to know about the various ways by which I can find the sql query errors .
    Any suggestions will be deeply appreciated.

    If you get the an error from SSMS and you can't comprehend it, you can google the error message and google would always lead you to the correction. Or you can post the error in this forum, people
    here are always kind and ready to help :).
    If you have any question, feel free to let me know.
    Eric Zhang
    TechNet Community Support

  • 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 Write A Sql Query to Show 0's

    I never can remember this :-/ What do I have to do to get a SQL Query to return 0 if the Count of a condition is 0?  For example lets say Joe, Jay, Jim could log on, but only Joe & Jim logged in Jay would not be returned in the query below.  What
    would I need to set-up so that All 3 users would be returned
    Select logonName, Count(Logon)
    From logonUserInfo
    where logonName is not nullGROUP BY logonName

    Currently there is only 1 table involved.  I would need a separate table?  What would this table need to hold?
    You wouldn't need a separate table unless and until you want to store who logged in at what time and so on... then your table structures looks like below..
    CREATE TABLE loginnames
    loginid INT
    name VARCHAR(30),
    GO
    CREATE TABLE loginTimes
    loginid INT,
    logintime DATETIME
    GO
    So, now you can do a left join on both tables on a certain date directly and find out who actually logined and who didn't with a count 0 for the one's who didn't login... and that will abide the principles of normalization as well...
    If you don't want to use an another table, you would have to duplicate the loginnames everytime that user logins and also you don't have a track on what date the login happened.. So you will be considering from day 1 to Till date...
    Please mark as answer, if this has helped you solve the issue.
    Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • 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 tune past SQL query??

    Hi Team,
    Straight to issue --> I am seeing an query running for long time. When i begun to trace that particular query it got over by the time and now how to trace that specific SID and QUERY..
    I am working on 10.2.0.4 version DB..
    How to trace an sql query after its execution?? pls provide steps how to begin with..
    regards
    dkoracle

    dkoracle wrote:
    Hi Team,
    Straight to issue --> I am seeing an query running for long time. When i begun to trace that particular query it got over by the time and now how to trace that specific SID and QUERY..
    I am working on 10.2.0.4 version DB..
    How to trace an sql query after its execution?? pls provide steps how to begin with..Can not be done.
    ALTER SESSION SET SQL_TRACE=TRUE;
    -- run query again

  • How to write a SQL query in SAP B1 2007 B with input parameters?

    How to write a SQL query in SAP B1 2007 B with input parameters, on execution of which will ask for some input value from the user and the values will be selected from a list such as item list?

    The syntax like
    SELECT * FROM OITM T0 WHERE T0.ItemCode = '[%0\]'
    Thanks,
    Gordon

  • How to get rid of the error message we could not complete your iTunes store request?

    How to get rid of the error message we could not complete your iTunes store request?
    having this problem when trying to authorise an newly downloaded app in iTunes

    Based on the numerous posts regarding iTunes and the App Store, there appears to be an issue at Apple's end. Although Apple has not provided any indication on the cloud status page.
    Do not change your settings.
    Edit

Maybe you are looking for

  • How to install an OS on a Mac Pro without using a startup disk

    Good Evening... I have purchased an Mac Pro 4,1 without any HDD attached to it and I have no startup disk for the installation an OS... When I do power on the Mac Pro, I get a flashing folder with a question mark in it! How can I be able to add an OS

  • Issue In query output

    Hello Gurus, I am having an issue with query output.Please find below the details of it Unsold claims: Total---> 200 Dispatch: Total--->118,086 Unsold claims/dispatch--->0.001694 This should be the output but its coming --.0033120 because itu2019s di

  • Inspection Lot status not getting changed to LTCA from REL for SubCon scenario

    Dear All, For ERSA material 01 inspection type is active with indicator Post to inspection stock only as it can be purchased. No other indicator is set. This material can be sent for repairing outside with DAMAGE valuation type (stock provided to Ven

  • Itunes store does not load

    Hello, I am unable to connect to itunes store. There is no error message showing. Just the loading bar moves half way accross and then I am left with a white screen. I have checked the following; internet works fine, i am able to dowload music art, m

  • SAP Transaction in iView

    Hi. I would like to bring a SAP Transaction into an iView and using SAP GUI for Java. I manage to create an iView based on SAP Transaction iView template delivered with the portal. However, when the iView was launched, it shows: “Error connecting to