What is LAST_ACTIVE_TIME  column in v$sql view

Hi,
I am using Oracle 10.2.0.3 version.
I have a doubt in v$sql view.
What is the meaning of LAST_ACTIVE_TIME column in v$sql view?
I presume it is the latest time when this SQL was executed in the database. M I right?
As per Oracle docs it's definition is as below.
LASTACTIVE_TIME - Time at which the query plan was last active ._
Thanks in advance.
Best Regards,
oratest

Dear oratest,
Please see the following link;
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2113.htm#REFRN30246
+"+
+LAST_ACTIVE_TIME+
+DATE+
+Time at which the query plan was last active+
+"+
That is the time that the "query plan" active period. I think this could be as what you have said.
Regards.
Ogan
Edited by: Ogan Ozdogan on 30.Ağu.2010 22:21

Similar Messages

  • SQL Views for applications, deployment types and deployments

    Has anyone seen any diagrams yet of the relationship between the views in the database for applications?  They are needless to say quite a bit more complex than the old Packages/Programs/Advertisements views.  I can probably figure out what I need,
    but it would save quite a time to be able to see the relationships called out.  A description of what some of the views actually do would be helpful too, I can figure out some, but others are a bit obtuse.
    Unfortunately there isn't an out of the box report that shows the information my customer wants, so I have to create one from scratch.
    If anyone is currious they want to see the status for all the computers that are targetted with an application deployment, this would include error codes, status, ect...
    Bob

    Yes, I know this is an old post, but I’m trying to clean them up. Did you solve this problem, if so what was the solution?
    The SQL view document has been release, it should help you out.
    https://technet.microsoft.com/en-us/library/dn581978.aspx
    Garth Jones | My blogs: Enhansoft and
    Old Blog site | Twitter:
    @GarthMJ

  • Export SQL View to Flat File with UTF-8 Encoding

    I've setup a package in SSIS to export a SQL view to a flat file and it's working fine.  I now need to make that flat file UTF-8 encoded.  The package executes but still shows the files as ANSI encoded.
    My package consists of a Source (SQL View) -> Derived Column (casts the fields to DT_WSTR) -> Destination Flat File (Set to output UTF-8 file).
    I don't get any errors to help me troubleshoot further.  I'm running SQL Server 2005 SP2.

    Unless there is a Byte-Order-Marker (BOM - hex file prefix: EF BB BF) at the beginning of the file, and unless your data contains non-ASCII characters, I'm unsure there is a technical difference in the files, Paul.
    That is, even if the file is "encoded" UTF-8, if your data is only ASCII values (decimal values 0-127, hex 00-7F), UTF-8 doesn't really serve a purpose over ANSI encoding.  Now if you're looking for UTF-8 with specifically the BOM included, and your data is all standard ASCII, the Flat File Connection Manager can't do that, it seems.
    What the flat file connection manager is doing correctly though, is encoding values that are over decimal 127/hex 7F in UTF-8 when the encoding of the connection manager is set to 65001 (UTF-8).
    Example:
    Input data built with a script component as a source (code at the bottom of this post) and with only one WSTR output column hooked to a flat file destination component:
    a string containing only decimal value 225 (german Eszett character - ß)
    Encoding set to ANSI 1252 looks like:
    E1 0D 0A (which is the ANSI encoding of the decimal character value 225 (E1) and a CR-LF (0D 0A)
    Encoding set to UTF-8 65001 looks like:
    C3 A1 0D 0A  (which is the UTF-8 encoding of the decimal character value 225 (C3 A1) and a CR-LF (0D 0A)
    Note that for values over decimal 127, UTF-8 takes at least two bytes and up to four for the remaining values available.
    So, I'm comfortable now, after sitting down and going through this, that the flat file connection manager is working correctly, unless you need a BOM.
    1
    Imports System  
    2
    Imports System.Data  
    3
    Imports System.Math  
    4
    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper  
    5
    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper  
    6
    7
    Public Class ScriptMain  
    8
        Inherits UserComponent  
    9
    10
        Public Overrides Sub CreateNewOutputRows()  
    11
            Output0Buffer.AddRow()  
    12
            Output0Buffer.col1 = ChrW(225)  
    13
        End Sub 
    14
    15
    End Class 
    Phil

  • Using Sql views in Load rules

    <p>I am trying to create a load rule from a SQL view. When I openthe Sql in the Rules file, the headers show up, but there is nodata.</p><p>Is there something else I need to do? (I did not create the SQLviews myself)</p><p>I am quite capable of loading data/dimensions from a SQL queryor table, but this table needed to be combined with another so myMIS supprt created a view for me to use to load from.</p><p> </p><p>Any help would be greatly appreciated!</p><p> </p><p> </p>

    I had probems with certain column types in the past. Had to convert them to strings. It's been a while so I dont remember what type. The best way to find something like this is to modify your sql to return one column, try it and see it it works, if it does, then add a the second column, etc. It can be tedious if you have a lot of columns but beats sitting there scratching your head.

  • Messy RUN_STATUS column values in public view ALL_RT_AUDIT_MAP_RUNS

    Is it true, that there is a bug in view ALL_RT_AUDIT_MAP_RUNS column RUN_STATUS?
    This view is based on table WB_RT_AUDIT. View's column RUN_STATUS is based on tables column named RTA_STATUS.
    Firstly, RTA_STATUS in the table is numeric and RUN_STATUS is computed like this:
    decode (a.rta_status, 'BEGIN', 'RUNNING', 'FAILED', 'FAILURE', 'COMPLETE') as run_status.
    It means, that the result value of RUN_STATUS is always 'COMPLETE'.
    Moreover, table WB_RT_AUDIT column RTA_STATUS shows value 1, when mapping runs without errors and shows 1 also, when mapping fails.
    What is the best indicator from public views or runtime audit tables to show that mapping has completed successfully? Is it return_result or return_code column form view ALL_RT_AUDIT_EXECUTIONS (table WB_RT_AUDIT_EXECUTIONS)?
    Finally, what's the difference between WB_RT_AUDIT_EXECUTIONS and WB_RT_AUDIT. Is it possible to have more than one WB_RT_AUDIT rows for one WB_RT_AUDIT_EXECUTIONS row?
    Thank you,
    -- Trying to upgrade from OWB 9.0.2 to 10.1 :S

    Here is the original procedure. I have since created a procedure which pulls the values from memory using dynamic sql, and this seems to work.
    PROCEDURE CREATE_DW_PROCESS_JOURNAL1(p_business_area IN VARCHAR2,
    p_map_id IN NUMBER) AS
    l_map_name OWBSYS.ALL_RT_AUDIT_MAP_RUNS.MAP_NAME%TYPE := NULL;
    l_yn_flag VARCHAR2(1):= 'N';
    BEGIN
    IF(p_map_id IS NOT NULL) THEN
    --For the audit id passed in open the cursor to get the information available
    INSERT INTO dw_process_journal(id, business_area, map_name, process_start_date, process_finish_date,
    run_status, error_count, inserted_count, updated_count, merged_count, elapsed_seconds, corrected_count,
    map_run_id, execution_audit_id)
    SELECT dw_process_journal_seq.nextval, p_business_area, map_name, start_time, end_time,
    run_status, number_errors, number_records_inserted, number_records_updated, number_records_merged, elapse_time, number_records_corrected,
    map_run_id, execution_audit_id
    FROM owbsys.ALL_RT_AUDIT_MAP_RUNS
    WHERE MAP_RUN_ID =p_audit_id;
    commit;
    END IF; -- p_audit_id
    END CREATE_DW_PROCESS_JOURNAL1;

  • V$SQL View underlying definition

    HI
    Is it possible to get underlying deifintion of v$views ? ( if i query text from dba_views i see v_$sql is selecting from v$sql)
    I want to know what are the underlying tables used for v$sql.How can i find that
    Thanks

    sb92075 wrote:
    894365 wrote:
    HI
    Is it possible to get underlying deifintion of v$views ? ( if i query text from dba_views i see v_$sql is selecting from v$sql)
    I want to know what are the underlying tables used for v$sql.How can i find thatAny/all of the V$* "views" query SGA data structures & are presented as regular SQL Views.Which may be true, but doesn't answer his question.
    The way it works is, let's take V$SQL as an example:
    SQL> select owner,object_type,object_name from dba_objects where object_name='V$SQL';
    OWNER        OBJECT_TYPE            OBJECT_NAME
    PUBLIC        SYNONYM            V$SQL
    SQL> So, V$SQL is actually a public synonym. Let's see what it points at:
    SQL> exec print_table('select owner,synonym_name,table_owner,table_name,db_link from dba_synonyms where owner=''PUBLIC'' and synonym_name = ''V$SQL''');
    OWNER                     : PUBLIC
    SYNONYM_NAME                : V$SQL
    TABLE_OWNER                : SYS
    TABLE_NAME                : V_$SQL
    DB_LINK                 :
    PL/SQL procedure successfully completed.Now, we can see that V$SQL is a public synonym that points to SYS.V_$SQL. Now, DBA_SYNONYMS says it's a table, but, it could also be a view. And, in this case, it is a view.
    We can see that here:
    SQL> exec print_table('select owner,object_type,object_name from dba_objects where owner=''SYS'' and object_name =''V_$SQL''');
    OWNER                     : SYS
    OBJECT_TYPE                : VIEW
    OBJECT_NAME                : V_$SQL
    PL/SQL procedure successfully completed.Ok, so V_$SQL is a view.
    Let's see what it's definition is:
    SQL> exec print_table('select text from dba_views where owner=''SYS'' and view_name = ''V_$SQL''');
    TEXT                     : select
    "SQL_TEXT","SQL_FULLTEXT","SQL_ID","SHARABLE_MEM","PERSISTENT_MEM","RUNTIME_MEM"
    ,"SORTS","LOADED_VERSIONS","OPEN_VERSIONS","USERS_OPENING","FETCHES","EXECUTIONS
    ","PX_SERVERS_EXECUTIONS","END_OF_FETCH_COUNT","USERS_EXECUTING","LOADS","FIRST_
    LOAD_TIME","INVALIDATIONS","PARSE_CALLS","DISK_READS","DIRECT_WRITES","BUFFER_GE
    TS","APPLICATION_WAIT_TIME","CONCURRENCY_WAIT_TIME","CLUSTER_WAIT_TIME","USER_IO
    _WAIT_TIME","PLSQL_EXEC_TIME","JAVA_EXEC_TIME","ROWS_PROCESSED","COMMAND_TYPE","
    OPTIMIZER_MODE","OPTIMIZER_COST","OPTIMIZER_ENV","OPTIMIZER_ENV_HASH_VALUE","PAR
    SING_USER_ID","PARSING_SCHEMA_ID","PARSING_SCHEMA_NAME","KEPT_VERSIONS","ADDRESS
    ","TYPE_CHK_HEAP","HASH_VALUE","OLD_HASH_VALUE","PLAN_HASH_VALUE","CHILD_NUMBER"
    ,"SERVICE","SERVICE_HASH","MODULE","MODULE_HASH","ACTION","ACTION_HASH","SERIALI
    ZABLE_ABORTS","OUTLINE_CATEGORY","CPU_TIME","ELAPSED_TIME","OUTLINE_SID","CHILD_
    ADDRESS","SQLTYPE","REMOTE","OBJECT_STATUS","LITERAL_HASH_VALUE","LAST_LOAD_TIME
    ","IS_OBSOLETE","IS_BIND_SENSITIVE","IS_BIND_AWARE","IS_SHAREABLE","CHILD_LATCH"
    ,"SQL_PROFILE","SQL_PATCH","SQL_PLAN_BASELINE","PROGRAM_ID","PROGRAM_LINE#","EXA
    CT_MATCHING_SIGNATURE","FORCE_MATCHING_SIGNATURE","LAST_ACTIVE_TIME","BIND_DATA"
    ,"TYPECHECK_MEM","IO_CELL_OFFLOAD_ELIGIBLE_BYTES","IO_INTERCONNECT_BYTES","PHYSI
    CAL_READ_REQUESTS","PHYSICAL_READ_BYTES","PHYSICAL_WRITE_REQUESTS","PHYSICAL_WRI
    TE_BYTES","OPTIMIZED_PHY_READ_REQUESTS","LOCKED_TOTAL","PINNED_TOTAL","IO_CELL_U
    NCOMPRESSED_BYTES","IO_CELL_OFFLOAD_RETURNED_BYTES" from v$sql
    PL/SQL procedure successfully completed.Huh? How can V_$SQL be based on V$SQL, when V$SQL is a synonym that points to V_$SQL??
    Well, this is where the trick comes in. SYS.V$SQL is a fixed view, i.e. a view that is owned by SYS and starts with 'V$' or 'GV$'.
    So, we can look at V$FIXED_VIEW_DEFINITION to see the definition of SYS.V$SQL:
    SQL> exec print_table('select view_definition from v$fixed_view_definition where view_name = ''V$SQL''');
    VIEW_DEFINITION            : select     SQL_TEXT , SQL_FULLTEXT , SQL_ID,
    SHARABLE_MEM , PERSISTENT_MEM , RUNTIME_MEM , SORTS , LOADED_VERSIONS ,
    OPEN_VERSIONS , USERS_OPENING , FETCHES , EXECUTIONS , PX_SERVERS_EXECUTIONS ,
    END_OF_FETCH_COUNT, USERS_EXECUTING , LOADS , FIRST_LOAD_TIME, INVALIDATIONS,
    PARSE_CALLS , DISK_READS , DIRECT_WRITES , BUFFER_GETS , APPLICATION_WAIT_TIME,
    CONCURRENCY_WAIT_TIME, CLUSTER_WAIT_TIME, USER_IO_WAIT_TIME, PLSQL_EXEC_TIME,
    JAVA_EXEC_TIME, ROWS_PROCESSED , COMMAND_TYPE , OPTIMIZER_MODE , OPTIMIZER_COST,
    OPTIMIZER_ENV, OPTIMIZER_ENV_HASH_VALUE, PARSING_USER_ID , PARSING_SCHEMA_ID ,
    PARSING_SCHEMA_NAME, KEPT_VERSIONS , ADDRESS , TYPE_CHK_HEAP , HASH_VALUE,
    OLD_HASH_VALUE, PLAN_HASH_VALUE, CHILD_NUMBER, SERVICE, SERVICE_HASH, MODULE,
    MODULE_HASH , ACTION , ACTION_HASH ,  SERIALIZABLE_ABORTS , OUTLINE_CATEGORY,
    CPU_TIME, ELAPSED_TIME, OUTLINE_SID, CHILD_ADDRESS, SQLTYPE, REMOTE,
    OBJECT_STATUS, LITERAL_HASH_VALUE, LAST_LOAD_TIME, IS_OBSOLETE,
    IS_BIND_SENSITIVE, IS_BIND_AWARE, IS_SHAREABLE,CHILD_LATCH, SQL_PROFILE,
    SQL_PATCH, SQL_PLAN_BASELINE, PROGRAM_ID, PROGRAM_LINE#,
    EXACT_MATCHING_SIGNATURE, FORCE_MATCHING_SIGNATURE, LAST_ACTIVE_TIME, BIND_DATA,
    TYPECHECK_MEM, IO_CELL_OFFLOAD_ELIGIBLE_BYTES, IO_INTERCONNECT_BYTES,
    PHYSICAL_READ_REQUESTS, PHYSICAL_READ_BYTES, PHYSICAL_WRITE_REQUESTS,
    PHYSICAL_WRITE_BYTES, OPTIMIZED_PHY_READ_REQUESTS, LOCKED_TOTAL, PINNED_TOTAL,
    IO_CELL_UNCOMPRESSED_BYTES, IO_CELL_OFFLOAD_RETURNED_BYTES from GV$SQL where
    inst_id = USERENV('Instance')
    PL/SQL procedure successfully completed.So, SYS.V$SQL is based on GV$SQL. So, what's GV$SQL??
    SQL> exec print_table('select owner,object_type,object_name from dba_objects where object_name =''GV$SQL''');
    OWNER                     : PUBLIC
    OBJECT_TYPE                : SYNONYM
    OBJECT_NAME                : GV$SQL
    PL/SQL procedure successfully completed.Another synonym?? Where does it all end?? (Hang in there, we're almost there!)
    So, what does the GV$SQL synonym point to?
    SQL> exec print_table('select * from dba_synonyms where owner=''PUBLIC'' and synonym_name = ''GV$SQL''');
    OWNER                     : PUBLIC
    SYNONYM_NAME                : GV$SQL
    TABLE_OWNER                : SYS
    TABLE_NAME                : GV_$SQL
    DB_LINK                 :
    PL/SQL procedure successfully completed.Ok, so, now we have GV_$SQL. What's that, exactly? Is it really a table? Or perhaps another view?
    SQL> exec print_table('select owner,object_type,object_name from dba_objects where owner=''SYS'' and object_name = ''GV_$SQL''');
    OWNER                     : SYS
    OBJECT_TYPE                : VIEW
    OBJECT_NAME                : GV_$SQL
    PL/SQL procedure successfully completed.Ok, so GV_$SQL is another view. Let's look at that definition!
    SQL> exec print_Table('select text from dba_views where owner=''SYS'' and view_name = ''GV_$SQL''');
    TEXT                     : select
    "INST_ID","SQL_TEXT","SQL_FULLTEXT","SQL_ID","SHARABLE_MEM","PERSISTENT_MEM","RU
    NTIME_MEM","SORTS","LOADED_VERSIONS","OPEN_VERSIONS","USERS_OPENING","FETCHES","
    EXECUTIONS","PX_SERVERS_EXECUTIONS","END_OF_FETCH_COUNT","USERS_EXECUTING","LOAD
    S","FIRST_LOAD_TIME","INVALIDATIONS","PARSE_CALLS","DISK_READS","DIRECT_WRITES",
    "BUFFER_GETS","APPLICATION_WAIT_TIME","CONCURRENCY_WAIT_TIME","CLUSTER_WAIT_TIME
    ","USER_IO_WAIT_TIME","PLSQL_EXEC_TIME","JAVA_EXEC_TIME","ROWS_PROCESSED","COMMA
    ND_TYPE","OPTIMIZER_MODE","OPTIMIZER_COST","OPTIMIZER_ENV","OPTIMIZER_ENV_HASH_V
    ALUE","PARSING_USER_ID","PARSING_SCHEMA_ID","PARSING_SCHEMA_NAME","KEPT_VERSIONS
    ","ADDRESS","TYPE_CHK_HEAP","HASH_VALUE","OLD_HASH_VALUE","PLAN_HASH_VALUE","CHI
    LD_NUMBER","SERVICE","SERVICE_HASH","MODULE","MODULE_HASH","ACTION","ACTION_HASH
    ","SERIALIZABLE_ABORTS","OUTLINE_CATEGORY","CPU_TIME","ELAPSED_TIME","OUTLINE_SI
    D","CHILD_ADDRESS","SQLTYPE","REMOTE","OBJECT_STATUS","LITERAL_HASH_VALUE","LAST
    _LOAD_TIME","IS_OBSOLETE","IS_BIND_SENSITIVE","IS_BIND_AWARE","IS_SHAREABLE","CH
    ILD_LATCH","SQL_PROFILE","SQL_PATCH","SQL_PLAN_BASELINE","PROGRAM_ID","PROGRAM_L
    INE#","EXACT_MATCHING_SIGNATURE","FORCE_MATCHING_SIGNATURE","LAST_ACTIVE_TIME","
    BIND_DATA","TYPECHECK_MEM","IO_CELL_OFFLOAD_ELIGIBLE_BYTES","IO_INTERCONNECT_BYT
    ES","PHYSICAL_READ_REQUESTS","PHYSICAL_READ_BYTES","PHYSICAL_WRITE_REQUESTS","PH
    YSICAL_WRITE_BYTES","OPTIMIZED_PHY_READ_REQUESTS","LOCKED_TOTAL","PINNED_TOTAL",
    "IO_CELL_UNCOMPRESSED_BYTES","IO_CELL_OFFLOAD_RETURNED_BYTES" from gv$sql
    PL/SQL procedure successfully completed.Another GV$SQL?? Does this ever end???
    Back to V$FIXED_VIEW_DEFINITION for the final round:
    SQL> exec print_table('select view_definition from v$fixed_view_definition where view_name = ''GV$SQL''');
    VIEW_DEFINITION            : select inst_id,kglnaobj,kglfnobj,kglobt03,
    kglobhs0+kglobhs1+kglobhs2+kglobhs3+kglobhs4+kglobhs5+kglobhs6+kglobt16,
    kglobt08+kglobt11, kglobt10, kglobt01, decode(kglobhs6,0,0,1),
    decode(kglhdlmd,0,0,1), kglhdlkc, kglobt04, kglobt05, kglobt48, kglobt35,
    kglobpc6, kglhdldc, substr(to_char(kglnatim,'YYYY-MM-DD/HH24:MI:SS'),1,19),
    kglhdivc, kglobt12, kglobt13, kglobwdw, kglobt14, kglobwap, kglobwcc, kglobwcl,
    kglobwui, kglobt42, kglobt43, kglobt15, kglobt02, decode(kglobt32,       0,
    'NONE',        1, 'ALL_ROWS',          2, 'FIRST_ROWS',          3, 'RULE',
    4, 'CHOOSE',            'UNKNOWN'), kglobtn0, kglobcce, kglobcceh, kglobt17,
    kglobt18, kglobts4, kglhdkmk, kglhdpar, kglobtp0, kglnahsh, kglobt46, kglobt30,
    kglobt09, kglobts5, kglobt48, kglobts0, kglobt19, kglobts1, kglobt20, kglobt21,
    kglobts2, kglobt06, kglobt07, decode(kglobt28, 0, to_number(NULL), kglobt28),
    kglhdadr, kglobt29, decode(bitand(kglobt00,64),64, 'Y', 'N'), decode(kglobsta,
    1, 'VALID',        2, 'VALID_AUTH_ERROR',      3, 'VALID_COMPILE_ERROR',
    4, 'VALID_UNAUTH',       5, 'INVALID_UNAUTH',           6, 'INVALID'), kglobt31,
    substr(to_char(kglobtt0,'YYYY-MM-DD/HH24:MI:SS'),1,19), decode(kglobt33, 1, 'Y',
    'N'),  decode(bitand(kglobacs, 1), 1, 'Y', 'N'),  decode(bitand(kglobacs, 2), 2,
    'Y', 'N'),  decode(bitand(kglobacs, 4), 4, 'Y', 'N'),  kglhdclt, kglobts3,
    kglobts7, kglobts6, kglobt44, kglobt45,  kglobt47, kglobt49, kglobcla,
    kglobcbca, kglobt22, kglobt52, kglobt53, kglobt54, kglobt55,  kglobt56,
    kglobt57, kglobt58, kglobt23, kglobt24, kglobt59,  kglobt53 -
    ((kglobt55+kglobt57) - kglobt52)  from x$kglcursor_childSo, here we are, finally, we get to the fabled 'X$' table! An X$ table is hardcoded into the Oracle kernel, and it's a table projection of a chunk of the SGA memory. It's can't be updated, only queried, and is not subject to read consistency.
    I'm sure this post will raise questions, but it's already too long, so, I'll leave it at that.
    Feel free to ask follow up questions, and I'll try to address them.
    Hope that helps,
    -Mark

  • How to export data with column headers in sql server 2008 with bcp command?

    Hi all,
    I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
    am trying to import data with bcp command data has been copied but column names are not came.
    I am using the below query:-
    EXEC master..xp_cmdshell
    'BCP "SELECT  * FROM   [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
    Thanks,
    SAAD.

    Hi All,
    I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
    DECLARE @BCPCMD
    nvarchar(4000)
    DECLARE @BCPCMD1
    nvarchar(4000)
    DECLARE @BCPCMD2
    nvarchar(4000)
    DECLARE @SQLEXPRESS
    varchar(50)
    DECLARE @filepath
    nvarchar(150),@SQLServer
    varchar(50)
    SET @filepath
    = N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
    as varchar(4))
    +RIGHT('00'+CAST(MONTH(GETDATE())
    as varchar(2)),2)
    +RIGHT('00'+CAST(DAY(GETDATE())
    as varchar(2)),2)+'.log" '
    Set @SQLServer
    =(SELECT
    @@SERVERNAME)
    SELECT @BCPCMD1
    = '''BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT '
    SELECT @BCPCMD2
    = '-c -t , -T -S '
    + @SQLServer + 
    SET @BCPCMD
    = @BCPCMD1+ @filepath 
    + @BCPCMD2
    Print @BCPCMD
    -- Print out below
    'BCP "SELECT 
    * FROM   [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
    EXEC
    master..xp_cmdshell
    @BCPCMD
      ''BCP' is not recognized as an internal or external command,
    operable program or batch file.
    NULL
    if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
    EXEC
    master..xp_cmdshell
    'BCP "SELECT  * FROM  
    [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
    Thanks, SAAD.

  • Report Based on SQL view not pulling in all parameters

    Post Author: ronhawker
    CA Forum: .NET
    I based a report on a SQL view below:SELECT     TOP (100) PERCENT CorpDirectory.Position, CorpDirectory.PhoneDirect, CorpDirectory.Email, CorpDirectory.Store, CorpDirectory.Name,                       CorpDirectory.PhoneFaxWave, CorpDirectory.Department, Store.StoreName, Store.StoreStreetAddress, Store.StoreCity, Store.StoreState,                       Store.StoreZip, Store.StorePhone, CorpDirectory.DisplayOrderFROM         dbo.CorpDirectory AS CorpDirectory INNER JOIN                      dbo.Store AS Store ON CorpDirectory.Store = Store.StoreORDER BY CorpDirectory.Store, CorpDirectory.Department, CorpDirectory.DisplayOrder, CorpDirectory.Name When the report was created the order by sequence only brought in the first parameter of CorpDirectory.Store. It seemed to ignore the other three order by parameters. I am running 10.2 is VS2005.

    Sharmila,
    Thanks for your response. Maybe I wasn't clear enough in my previous statement. I will give an example of what I am trying to accomplish.
    Let's say I have 2 date fields(SUBMITDATE,COMPLETEDATE) in a table TABLE A
    I want to calculate a field called CYCLETIME with the following conditions:
    If COMPLTEDATE is NULL, then CYCLETIME = SYSDATE-SUBMITDATE
    IF COMPLTEEDATE is not null, then CYCLETIME = COMPLTEEDATE-SUBMITDATE
    Would appreciate any help.
    Thanks
    Dev
    Hi,
    You can do the calculation in the sql query itself. Here is an example which shows the sum of salaray for each department in the scott.emp table.
    select deptno,sum(sal) sal
    from scott.emp
    group by deptno
    Thanks,
    Sharmila

  • Custom column in a list view web part for a multilingual site does not take on custom language labels. Stays in default language.

    Hello all,
    I have what so far appears to be a fairly unique problem.  We are running a multilingual SharePoint 2010 environment with English as the default language and French as the secondary.  We have setup the sites in a variance relationship, but the
    issue I am discussing happens outside of a variant as well.
    We have created a library outside the variant (but within the collection) that the two sites must share.  A list view web part was created via Designer to add to each site to provide a quick view into the list.  If we are in the libary and switch
    to French, then update the column label it will remember the setting (because of the resource file) and maintain it as the language is flipped back and forth.  Where it doesn't work is as a web part in a variant or where the language is different.
    If the language is different, the out of the box columns work find, but the custom columns (all site columns not library\list columns) remain as the english label.  It doesn't matter if within a variant or outside with the browser language changed. 
    It always reverts back to English.  It's like it isn't using the same resource file that was used in the list itself.
    I created a custom view and modified it with xslt as per
    http://sharepoint.stackexchange.com/questions/50004/how-to-change-column-title-for-a-view-but-not-modify-the-list but this only worked within the list and did not occur in the list view either.
    I can't be the first that has come across it, either I am not performing my searches properly, no one has ever documented a fix for this or this is something we just can't fix with OOTB tools.  That's the other thing, the solution has to be accomplised
    OOTB or with minor client side changes.  I can't fire up Visual Studio because they are piloting Office 365 and have put a "No custom code" mandate on for migration.
    Thank you all in advance.

    Ok, I have come up with a solution.  I edited the XSLT for the web part on the page.  I did the following:
    1.    Create the variants in the Site Ccollection
    2.    Create the library outside of the variants.
    3.    Add all the columns you require for the library.  It is very important all the columns are there before you move on.
    4.    Create a French and English view.
    5.    Create the list view web part via designer.
    6.    Add the list view web part to each site selecting the appropriate view to use.
    7.      Edit the page in SharePoint Designer 2010.
    8.      Place cursor in the column you wish to modify.
    9.      Click Design in the List View Tools on the ribbon.  
    10.     Then click Customize XSLT and select Customize Item.  Select this option otherwise you will generate a **LOT** of unnecessary XSL code.
    11.     You are looking for a piece that resembles the following:
            <xsl:with-param name="fieldtitle">
              <xsl:value-of select="@DisplayName"/>
            </xsl:with-param>
    12.      Modify it by typing in the actual column name you want.  You should end up with something like this:
            <xsl:with-param name="fieldtitle">
              New Column Name.
            </xsl:with-param>
    13.      Now, for this page only, the column will be renamed.
    There are some caveats:
    1.    Doesn’t appear to work in a publishing portal.  I think this has to do with how SP stores the pages in this case.  In a publishing portal you can only modify the page layout which won’t work as we need to modify the content.
    2.    If you add another column, you will need to repeat the XSLT modification
    Anyways, I hope this helps out any others with the same issue or need as I had.

  • Coalesce in a SQL View?

    I have a table as shown below:
    I need to write a sql view that will show 1 row for the ReqNbr and then a column for the related service calls.  For example the result set should look something like this:
    ReqNbr, Call_Numbers
    10010, 0000013147;0000013097;0000013149;
    10592, 0000012994;0000012999;
    and so on.  I need a view that can do this as a function or stored procedure can't be used in the reporting tool that I'm dealing with.  In addition I would like the Service Call to be sorted ASC in the column when returned.
    Any ideas?

    You need to use a stuff operator for this purpose... see this
    http://sqlsaga.com/sql-server/how-to-concatenate-rows-into-one-row-using-stuff/
    DECLARE @Input TABLE
    ReqNbr INT,
    ServiceCall VARCHAR(20)
    INSERT INTO @Input VALUES(1, '0001'), (1, '0002'), (1, '0003'),(2,'0004'), (2,'0005'), (1, '0006')
    SELECT DISTINCT ReqNbr, STUFF((SELECT ';'+ServiceCall FROM @Input b WHERE a.ReqNbr = b.ReqNbr FOR XML PATH('')), 1, 1, '') AS ServiceCall
    FROM @Input a
    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.

  • Apex 4.0 display image item :BLOB column returned by SQL statement

    Hello
    I'm creating an display image item in apex 4.0. The source is a BLOB column returned by SQL statement.
    When I'm issuing an sql statement like this:
       select lado.blob_content
       from   large_documents      lado
       ,        large_doc_headers    ladh
       where lado.ladh_nr = ladh.nr
       more criteriait works fine.
    When I create a function inside a package with the same query (in a cursor)
    function get_image(some parameters in) return blob
    Following in apex by:
    select get_image(some parameters) from dualI get a
    ORA-06502: PL/SQL: numeric or value error: character string buffer too smallAnybody any idea why this does not work?
    Regards Erik

    Hi Eric,
    the environment assumes varchar2-output by default, which will be limited to 32767 characters and may have problems with binary formats. You could define a blob-variable to select the value into.
    DECLARE
      l_blob BLOB;
    BEGIN
      SELECT get_image(some parameters)
        INTO l_blob
        FROM dual;
    END;
    /If you expect the BLOB-Content to be text (you should consider CLOB then), you may use UTL_RAW.CAST_TO_VARCHAR2 to convert the content. If your object is larger than the maximum varchar2 size, or you want to convert BLOB to CLOB, you might be interested in some converter like described here: {message:id=559749}
    Hope this is what you were searching for.
    -Udo

  • Suddenly Genres column disappeared from List view

    Hi guys,
    I'm still running 8.0.2, and I can't figured out what happened; Genres column is disappeared from the list view and I couldn't find anyway to show it again.
    I also tried to reinstall iTunes 8.0.2, but nothing changed.
    Anyone know how to solve the problem?
    Thanks!

    Ok, just to make sure that I understand. In the list view in iTunes 8.0.2, you see artist & album column. In iTunes, just as the list starts it indicates what is listed in a gray bar. Right click on the bar & a menu should appear. From that list choose what you want to have displayed. The genera should be one of those options.
    If you are still experiencing issues at that point try the following article on Apple's support page:
    http://support.apple.com/kb/HT1224
    This will show you how to properly remove iTunes from your computer. After trying all of that with out any luck, call the support number & I know that an agent will be happy to help!

  • Display column name in sql*plus

    Hi,
    How to display full column name?
    there are n no of tables, i have to query the tables but i want the column name to be displayed fully. for example
    SQL> desc control
    Name Null? Type
    CODE NOT NULL VARCHAR2(255)
    LOAD_PERIOD_START_DATETIME DATE
    SQL> select code,load_period_start_datetime from control;
    CODE
    LOAD_PERIOD
    AAA
    01-AUG-2007
    SQL> col load_period_start_datetime format a30
    SQL> /
    CODE
    LOAD_PERIOD_START_DATETIME
    AAA
    01-AUG-2007
    SQL>
    As it is only one column i can set with 'col <column_name> format a 30'
    if there are n no of coumns from n no tables then how do i get the full column name?
    Please help me.
    Thanks

    Hi,
    you can get all the column's for a TABLE from all_tab_columns this VIEW, why dont you write as script which will generate the commands.
    Could you please tell us why do you want to display the compete COLUMN NAME in SQL plus.
    Thanks

  • What is wrong with these PL/SQL codes?

    DECLARE
    CURSOR C_All_Tables IS select table_name from user_tables where substr(table_name,1,1)='B';
    BEGIN
    For cnt1 in C_All_Tables Loop
    Declare
    CURSOR C_EachTable IS select NAME from cnt1.table_name;
    V_Result varchar2(20);
    Begin
    for cnt2 in C_EachTable Loop
    V_Result := substr(cnt2.name,1,3);
    EXIT when substr(cnt2.name,1,3) = 'K01' ;
    if V_Result != 'K01' then
         delete from cnt1.table_name where substr(NAME,1,3)=V_result;
         end if;
    end loop;
    End;
    End Loop;
    Commit;
    END;
    Here is the errors
    Error report:
    ORA-06550: line 8, column 56:
    PL/SQL: ORA-00942: table or view does not exist
    ORA-06550: line 8, column 34:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 12, column 43:
    PLS-00364: loop index variable 'CNT2' use is invalid
    ORA-06550: line 12, column 24:
    PL/SQL: Statement ignored
    ORA-06550: line 13, column 40:
    PLS-00364: loop index variable 'CNT2' use is invalid
    ORA-06550: line 13, column 23:
    PL/SQL: Statement ignored
    ORA-06550: line 15, column 37:
    PL/SQL: ORA-00942: table or view does not exist
    ORA-06550: line 15, column 19:
    PL/SQL: SQL Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    Could someone help me fix it. Thanks so much.

    something like this maybe?
    begin
        for c in (select table_name from user_tables where substr(table_name,1,1)='B' order by substr(table_name,1,3) ) loop
            EXIT when substr(c.table_name,1,3) = 'K01';
           execute immediate  ('delete from '||c.table_name||' where substr('||c.table_name||',1,3)= substr('||c.table_name||',1,3)');
        end loop;
    end;

  • What is wrong with this PL/SQL

    sqlplus -s enbref10/enbref10@q4enbdb << END_SQL
    set serveroutput on size 200000
    set feedback off
    DECLARE
    tableName VARCHAR2(40);
    ddl VARCHAR2(4000);
    rows NUMBER(4);
    BEGIN
    BEGIN
    SELECT TNAME INTO tableName FROM TAB WHERE TNAME = 'PC_EXTRACT_CURRENT';
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    DBMS_OUTPUT.PUT_LINE('Creating table PC_EXTRACT_CURRENT');
    ddl := 'CREATE TABLE PC_EXTRACT_CURRENT ( OFFER_ID NUMBER, TLG_SOC CHAR(10 BYTE), CPW_CODE CHAR(10 BYTE),
    OFFER_NAME CHAR(100 BYTE), OFFER_DESCRIPTION CHAR(100 BYTE), OFFER_TYPE CHAR(50 BYTE), OFFER_LEVEL CHAR(20 BYTE),
    SALES_EFFECTIVE DATE, SALES_EXPIRATION DATE, PACKAGE_ID NUMBER, PACKAGE_NAME CHAR(100 BYTE),
    PACKAGE_QUALIFICATION CHAR(100 BYTE), PRIT_ID NUMBER, ITEM_ROLE CHAR(10 BYTE), ITEM_NAME CHAR(100 BYTE),
    CHARGE_CODE CHAR(20 BYTE), PRIORITY NUMBER, PRIT_QUALIFICATION CHAR(100 BYTE), UOM CHAR(20 BYTE),
    QUOTA1 CHAR(15 BYTE), RATE CHAR(10 BYTE), NAME CHAR(100 BYTE), TLG_MARKETS CHAR(100 BYTE),
    OFFER_RELATION_TYPE CHAR(5 BYTE), OFFER_RELATION_ID NUMBER, OFFER_TYPE_IND CHAR(5 BYTE))' ;
    execute immediate DDL ;
    END ;
    SELECT count(*) INTO rows from PC_EXTRACT_CURRENT ;
    END ;
    exit ;
    END_SQL
    When i run this PL/SQL it gives me below error...
    SELECT count(*) INTO rows from PC_EXTRACT_CURRENT ;
    ERROR at line 23:
    ORA-06550: line 23, column 36:
    PL/SQL: ORA-00942: table or view does not exist
    ORA-06550: line 23, column 5:
    PL/SQL: SQL Statement ignored
    Table PC_EXTRACT_CURRENT do not exist and it should be created in the EXCEPTION block and the following statement " SELECT count(*) INTO rows from PC_EXTRACT_CURRENT ; " should not give any error.
    But the table is not created and the this statement fails when executed.
    I have no clue why it is happening .
    When i comment the line "SELECT count(*) INTO rows from PC_EXTRACT_CURRENT " it creates the table.

    This code would give compilation error at the
    following statement, if this table doesn't exist.
    SELECT count(*)
    INTO rows
    From SCHEMA.PC_EXTRACT_CURRENT;
      SELECT count(*)
        INTO vCount
        FROM ALL_TABLES
       WHERE table_name = 'PC_EXTRACT_CURRENT'
         And owner      = 'SCOTT';that is why you have this above code to check for the existence of the table for the same schema owner, assuming you are running this code logged to the database as SCOTT. this SCOTT schema is hardcode in replacement to the SCHEMA posted in the prior posted example. suppose the schema owner is SCOTT so we are checking the SCOTT.PC_EXTRACT_CURRENT object. now it does not found the object and it will result in vCount having a value of 0. then we go down to the next logic of the IF Then Else statement. It will execute the code under the IF vCount = 0 which is execute immediate to create the table.
    on the second time the script is run vCount will give you 1 value. now the when it goes to the IF then Else statement it will execute the code under the Else since vcount has a value of 1. then it does a query as
        SELECT count(*)
          INTO rows
          From SCOTT.PC_EXTRACT_CURRENT;we have the object SCOTT.PC_EXTRACT_CURRENT and this will not give you error since the object is existing.

Maybe you are looking for