Columns from table FLASHBACK_TRANSACTION_QUERY

Hi, have any problem with columns START_TIMESTAMP and COMMIT_TIMESTAMP from table FLASHBACK_TRANSACTION_QUERY ?
It's declarated in type DATE.
This is correct ?
Message was edited by:
anderson.rf
Message was edited by:
anderson.rf

Hi
If I understand correctly then you can use
SQL> select to_char(START_TIMESTAMP, 'DD/MM/YY HH:MI:SS') FROM FLASHBACK_TRANSACTION_QUERY
Hope it helps.
Rgds
Adnan

Similar Messages

  • XML Column from table extract to Pipe Delimited Text File

    Hi,
    I have an XML column with large data in a Table ( Source SQL server Database).
    I was asked to   extract    XML column to .txt file using SSIS.
    Is it possible to extract xml column with huge data to text file ?
    when I tried,  select XML column from Table in source , I noticed  that Property of column is taken as [DT_NTEXT] . I Converted it to DT_TEXT as Ansi donot support DT_NTEXT.
    Execution method was success but it failed due to trucation. so wondering is there a way to get XML column extracted to Pipe delimited text file?
    Is it advisable to do this ? or IS It Valid to export XML in Pipe Delimited File ?
    Please Kindly advice
    thanks
    kodi

    Are you looking at shredding data within XML nodes and then importing it to text file or are you looking at exporting XML value as is? Also is SSIS a necessity?
    If not, You can simply use T-SQL for this along with bcp for this. just use a query like
    EXEC xp_cmdshell 'bcp "SELECT CAST(XMLColumn AS varchar(max)) AS Column FROM table" queryout <full file path> -c -S <ServerName> -T -t |'
    provided you use trusted connection (windows authentication)
    see
    http://visakhm.blogspot.in/2013/10/bcp-out-custom-format-data-to-flat-file.html
    If you want to shred the data use Xpath functions in the query as below
    http://visakhm.blogspot.in/2012/10/shred-data-as-well-as-metadata-from-xml.html
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Cannot drop column from table owned by SYS

    Hello everybody,
    How can I drop a column of table which is owned by sys? thanks!
    Result as follows:
    SQL> ALTER TABLE HELLO_TB DROP COLUMN NUM;
    ALTER TABLE HELLO_TB DROP COLUMN NUM
    ERROR at line 1:
    ORA-12988: cannot drop column from table owned by SYS
    newbie v

    You can not 'change' the ownership.
    You can, however, 'move' or 'clone' most objects by exporting and importing. As follows:
    I create a table under SYS (shudder).
    I then export it
    - using userid SYS in this case,
    - under normal circumstances I'd either use a DBA account or the owner's userid
    - since I want a table, I use the TABLES option - a list is comma separated and in quotes
    I then import it using a 'userid' switch - fromuser & touser options
    - in this case from SYS to HR
    Finally, I verify it was transported.
    Actual console session in Linux follows:
    pop2@fuzzy:~> sqlplus / as sysdba
    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 10 19:58:01 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> create table test1 ( x1 number );
    Table created.
    SQL> insert into test1 values (2);
    1 row created.
    SQL> select * from test1;
            X1
             2
    SQL> Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    pop2@fuzzy:~> exp file=exp.dmp tables='TEST1'
    Export: Release 10.2.0.1.0 - Production on Fri Mar 10 20:00:07 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Username: sys/????? as sysdba
    Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    Export done in AL32UTF8 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    . . exporting table                          TEST1          1 rows exported
    Export terminated successfully without warnings.
    pop2@fuzzy:~> imp file=exp.dmp fromuser=sys touser=hr
    Import: Release 10.2.0.1.0 - Production on Fri Mar 10 20:00:44 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Username: sys/????? as sysdba
    Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    Export file created by EXPORT:V10.02.01 via conventional path
    import done in AL32UTF8 character set and AL16UTF16 NCHAR character set
    . importing SYS's objects into HR
    . . importing table                        "TEST1"          1 rows imported
    Import terminated successfully without warnings.
    pop2@fuzzy:~> sqlplus hr/hr
    SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 10 20:00:57 2006
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Connected to:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
    SQL> select * from test1;
            X1
             2
    SQL>The export/import pair are incredibly powerful - and few people understand them well. If you are interested in digging into their capability, check out their chapters in the Utilities manual (under the Books tab) at http://www.oracle.com/pls/db102/portal.portal_db?selected=1

  • End User will build the report by himself by choosing the columns from tabl

    We are using Oracle 10g Application server (Forms and Report Services), Forms and Report., our most urgent requirement is End User have to build the required reports by him Like wizards style, (Example Adhoc, MIS reports)., More clear, from the form we want to show all the tables structures, queries, after that end user will choose some columns from the form and specified the condition by himself to run the report after that he will press start button , then automatically report has build for the selected columns from the end user., and this report is parmanent afterwords., he can use any time.
    Like this kind of report building is possiable , anyone has faced same situation.

    Yes it is.
    In BW, this can be achieved by using document management. The option will be available to the user via context menu in the report (goto-->documents - text/pdf/img etc). In your case user can choose to create/change/display a 'text' document, which will be attached to the report.
    cheers,

  • Update table a columns using columns from table b (values of 2 columns of table b need to taken from table c)

    Guys,
    I need to update table A columns col3, col4, col5 and col6 by table b columns col3, col4, col5 and col6 however table b col5 and col6 values need to come from table c col1.
    Means table b col5 and col6 have values in it however i need to replace them with value from table c col1 and need to update table a col5 and col6 accordingly.
    table a and table b has col1 and col2 in common.
    i am trying something like this.
    Update a
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from table_c c where c.col2=b.col5),
    a.col6 = (select col1 from table_c c where c.col2=b.col6)
    from table_A a inner join table_b
    on  a.col1=b.col1 and a.col2=b.col2
    can someone help me reframe above update query?
    thanks in advance for your help.

    Try the below:(If you have multiple values, then you may need to use TOP 1 as commented code in the below script)
    create Table tableA(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableA values(1,2,3,4,5,6)
    create Table tableB(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableB values(1,2,30,40,50,60)
    create Table tableC(Col1 int,Col2 int,Col3 int,Col4 int,Col5 int,Col6 int)
    Insert into tableC values(100,50,30,40,2,2)
    --Insert into tableC values(200,50,30,40,2,2)
    Insert into tableC values(100,60,30,40,2,2)
    Select * From tablea
    Update a Set
    a.col3 = b.col3,
    a.col4 = b.col4,
    a.col5 = (select col1 from tablec c where c.col2=b.col5 ),
    a.col6 = (select col1 from tablec c where c.col2=b.col6 )
    from tableA a inner join tableb b
    on a.col1=b.col1 and a.col2=b.col2
    --Update a Set
    --a.col3 = b.col3,
    --a.col4 = b.col4,
    --a.col5 = (select Top 1 col1 from tablec c where c.col2=b.col5 Order by c.Col1 asc),
    --a.col6 = (select Top 1 col1 from tablec c where c.col2=b.col6 Order by c.Col1 asc)
    --from tableA a inner join tableb b
    --on a.col1=b.col1 and a.col2=b.col2
    Select * From tablea
    Drop table tablea,Tableb,TableC

  • Adding or Deleting Rows and Columns from Tables

    I have notices that you can't delete or add a row or columns from a table in iWeb without having problems.
    You may get two added or deleted.
    I should indicate that the table comes from Excel.
    Does anyone know of a work-around?

    Problem 1 - The sub-form 'Stds' was not configured for repeating rows.
    Problem 2 - The script was on the wrong event. The script should be on the 'change' event and not the 'initialize' event.
    Problem 3 - Which header row in which sub-form are you referring too?
    Steve

  • Delete a column froma  table that is used in multiple interfaces

    Is there a way to delete a column from a table where the table is being used in an interface ? The only way I could find so far was to delete the interface, delete the column then recreate the interface.
    Otherwise deleting warns that the object is referred to by another object and lists the interfaces.
    unfortunately the table in question is being referred to in multiple interfaces, so I'd prefer not to have to recreate all of them.
    Many thanks

    You can delete all the mappings (source an target) which refer to this column and then physically delete the column.
    It's long but maybe better than dropping the whole interfaces using this column.
    Regards and Merry Christmas
    Brice

  • Selecting all columns from table in a model query

    I have written a model query which joins 4 tables, applies some rules and returns updated rows by selecting 4 columns out of this. Currently it works fine because all 4 columns are from MODEL aliases. Now I need to select 16 more columns in the same query but none of these columns is added in MODEL aliases. When I tried selecting these columns I got oracle error ORA - 32614. Can someone please guide me to include these columns in the same model query?
    I tried couple of options but no luck. Here are those options for ready reference:
    1. I cannot nest existing model query into another select because there are no columns avaiable to join in output of current query to map with other records.
    2. I cannot include all 16 columns in MODEL aliases because some of these columns are actually output of user defined functions.
    I am using Oracle database version 11g Release 11.2.0.1.0.
    Edited by: Anirudha Dhopate on Jan 23, 2011 5:43 PM

    Thank you Avijit for your reply. There is a syntax error on the ON in this part of the statement which I don't know how to fix - I tried messing around with another INNER JOIN but am not confident that I'm doing the right thing:
    SENAlertType.SENAlertTypeIDONClassMember.ClassMemberStudentID
    Thanks for your help! I will need to do some more bedtime reading on joins.
    Daniel

  • Select columns from table for display in alvgrid.

    Hi all,
    i have the following:
    i do select a tablename and pass it as a parameter. then this table is loaded into an internal table and displayed in an alv-grid.
    what i now want to do is a step  between the both:
    after the internal table with its structure is loaded, i want to display the field columns and i want them to be selectable so that in the next step the alv - grid is selected only with the selected columns ( just now it allways runs with all columns - even the not needed ).
    Any ideas for that would be appreciated. Is there some tutorial on that or some sample ?

    hi
    chk this sample code:
    *REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid,
          gt_events     type slis_t_event,
          gd_prntparams type slis_print_alv.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform build_events.
    perform build_print_params.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
                it_events               = gt_events
                is_print                = gd_prntparams
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
      if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      endif.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    endform.                    " DATA_RETRIEVAL
    Form  TOP-OF-PAGE                                                 *
    ALV Report Header                                                 *
    Form top-of-page.
    *ALV Header declarations
    data: t_header type slis_t_listheader,
          wa_header type slis_listheader,
          t_line like wa_header-info,
          ld_lines type i,
          ld_linesc(10) type c.
    Title
      wa_header-typ  = 'H'.
      wa_header-info = 'EKKO Table Report'.
      append wa_header to t_header.
      clear wa_header.
    Date
      wa_header-typ  = 'S'.
      wa_header-key = 'Date: '.
      CONCATENATE  sy-datum+6(2) '.'
                   sy-datum+4(2) '.'
                   sy-datum(4) INTO wa_header-info.   "todays date
      append wa_header to t_header.
      clear: wa_header.
    Total No. of Records Selected
      describe table it_ekko lines ld_lines.
      ld_linesc = ld_lines.
      concatenate 'Total No. of Records Selected: ' ld_linesc
                        into t_line separated by space.
      wa_header-typ  = 'A'.
      wa_header-info = t_line.
      append wa_header to t_header.
      clear: wa_header, t_line.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                it_list_commentary = t_header.
               i_logo             = 'Z_LOGO'.
    endform.
          FORM USER_COMMAND                                          *
          --> R_UCOMM                                                *
          --> RS_SELFIELD                                            *
    FORM user_command USING r_ucomm LIKE sy-ucomm
                      rs_selfield TYPE slis_selfield.
    Check function code
      CASE r_ucomm.
        WHEN '&IC1'.
      Check field clicked on within ALVgrid report
        IF rs_selfield-fieldname = 'EBELN'.
        Read data table, using index of row user clicked on
          READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
        Set parameter ID for transaction screen field
          SET PARAMETER ID 'BES' FIELD wa_ekko-ebeln.
        Sxecute transaction ME23N, and skip initial data entry screen
          CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
        ENDIF.
      ENDCASE.
    ENDFORM.
    *&      Form  BUILD_EVENTS
          Build events table
    form build_events.
      data: ls_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = gt_events[].
      read table gt_events with key name =  slis_ev_end_of_page
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_PAGE' to ls_event-form.
        append ls_event to gt_events.
      endif.
        read table gt_events with key name =  slis_ev_end_of_list
                               into ls_event.
      if sy-subrc = 0.
        move 'END_OF_LIST' to ls_event-form.
        append ls_event to gt_events.
      endif.
    endform.                    " BUILD_EVENTS
    *&      Form  BUILD_PRINT_PARAMS
          Setup print parameters
    form build_print_params.
      gd_prntparams-reserve_lines = '3'.   "Lines reserved for footer
      gd_prntparams-no_coverpage = 'X'.
    endform.                    " BUILD_PRINT_PARAMS
    *&      Form  END_OF_PAGE
    form END_OF_PAGE.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      write: sy-uline(50).
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    *&      Form  END_OF_LIST
    form END_OF_LIST.
      data: listwidth type i,
            ld_pagepos(10) type c,
            ld_page(10)    type c.
      skip.
      write:/40 'Page:', sy-pagno .
    endform.
    **reward if helpful
    regards,
    madhu

  • Best way to join 2 columns from table A to same column in Table B?

    Hi,
    This is a simplified example of the query I'm trying to write.
    I have two tables - PIPELINE (which includes columns CREDIT_RECEIVER and CREATOR) and EMPLOYEES (which includes columns EMAIL and LOB).
    I want to write a query which joins PIPELINE.CREDIT_RECEIVER with EMPLOYEES.EMAIL to return LOB as "CREDIT_RECEIVER_LOB".
    I also want this query to join PIPELINE.CREATOR with EMPLOYEES.EMAIL to return LOB as "CREATOR_LOB".
    Currently, I am doing a left outer join on EMPLOYEES.EMAIL = PIPELINE.CREDIT_RECEIVER to get "CREDIT_RECEIVER_LOB", and calling a function GET_LOB(PIPELINE.CREATOR) (defined below) to get "CREATOR_LOB".
    Query:
    Select PIPELINE.ID as ID,
    PIPELINE.CREDIT_RECEIVER as CREDIT_RECEIVER,
    PIPELINE.CREATOR as CREATOR,
    EMPLOYEES.LOB as CREDIT_RECEIVER_LOB,
    GET_LOB(PIPELINE.CREATOR) as CREATOR_LOB
    FROM PIPELINE
    LEFT OUTER JOIN EMPLOYEES ON PIPELINE.CREDIT_RECEIVER=EMPLOYEES.EMAIL
    Is there a more efficient way to write this query? This query is so slow that it usually times out on me.
    Thanks,
    Forrest
    GET_LOB definition
    create or replace function "GET_LOB"
    (vemail in VARCHAR2)
    return VARCHAR2
    is
    begin
    DECLARE vLOB VARCHAR2(30);
    BEGIN
    SELECT LOB INTO vLOB FROM EMPLOYEES WHERE email = vemail;
    return vLOB;
    END;
    end;

    Select PIPELINE.ID as ID,
           PIPELINE.CREDIT_RECEIVER as CREDIT_RECEIVER,
           PIPELINE.CREATOR as CREATOR,
           e1.LOB as CREDIT_RECEIVER_LOB,
           e2.LOB as CREATOR_LOB
      FROM PIPELINE
      LEFT OUTER JOIN EMPLOYEES E1
        ON PIPELINE.CREDIT_RECEIVER = EMPLOYEES.EMAIL
      LEFT OUTER JOIN EMPLOYEES E2
        ON PIPELINE.CREATOR = EMPLOYEES.EMAIL
    Ramin Hashimzade

  • How Do I extract columns from Table

    Dear Everyone
    List the texts listed both required and recommended for ICT218 in Semester 2 2010. The first should have required with some way of distinguishing between and required and recommended. Thanks
    Select UnitCode, RequiredText, RecommendedReading, Name
    From Book TEACHINGPERIOD, UNITOffering U
    Where (UnitCode='ICT218') and (Name='Semester2');
    It didn't work because it's not properly ended. I think it needs a join somewhere.
    UnitOffering Table
    UnitOfID UnitTitle Tea Period UnitCode
    Vet006     Intro to Vet     20/01/10     Vet432
    MA004     Fundamentals of Maths     20/01/10     MA164
    LEA011     Intro to Legal Studies     20/08/10     LEA765
    ICT001     Databses     20/08/10     ICT218
    Hu002     Intro to History     20/01/10     HI154
    Phy003     Intro to Physics     20/02/10     Phy005
    LAW154     Intro to Law     20/08/10     Law001
    PSY154     Intro to Psychology     20/08/10     PSY001
    ICT009     Principles Of Computer Science     20/08/10     ICT104
    Bio007     Intro to Biology     20/08/10     BIO457
    Met008     Intro to Metalogy     20/08/10     Met432
    TeachingPeriod Table
    Name Year StartDate Teaching Period
    S1     2010     17/02/10     S12010
    T1     2010     23/03/10     T12010
    S2     2010     08/08/10     S22010
    SU1     2010     08/01/10     Su12010
    Su2     2010     10/08/10     Su22010
    T2     2010     10/08/10     T22010
    S1     2011     20/02/11     S12011
    S2     2011     20/07/11     S22011
    T1     2011     20/03/11     T12011
    T2     2011     20/08/11     T22011
    SU1     2011     20/02/11     SU12011
    SU2     2011     20/08/11     SU22011
    Book Table
    Isbn Number BookTitle Author Requir Recom
    9780321523068     Database Systems     Connolly and Begg     Yes     No     2009     BBN345
    8734512367845     Australian History     Martin and Malloy     Yes     No     2005     ABD265
    4589565321987     Great minds alike     Sheena Smith     Yes     No     2003     CAR789
    7653457609825     Biggest Atoms     Kevin Smith     Yes     No     2004     ADE498
    3178765145789     Animal Anatomy     Linda Pearce     Yes     No     2008     EAT543
    5234569012345     Great Maths     Ken Morgon     No     Yes     2006     FET987
    6124537890124     What Metals Can Do     Brian Deed     No      Yes     2007     GAT621
    1543278954326     Weird Biology     Shaun Diet     No     Yes     2002     ABC123
    2567458906276     Greatest Technology     Fran Day     No     Yes     2001     ACN456
    0125678432167     WorldWide Legal System     Claire Dawn     No     Yes     2000     ANB367
    0003456789079     Best Databases     Ken Murray     No     Yes     2002     BBN345
    Edited by: user9164240 on 29/10/2010 02:05

    Desc UnitOffering
    "UNITOFFERINGID"     "UNITTITLE"     "TEACHINGPERIOD"     "UNITCODE"
    "Vet006"          "Intro to Vet"          20/01/10     "Vet432"
    "MA004"          "Fundamentals of Maths"     20/01/10     "MA164"
    "LEA011"          "Intro to Legal Studies"20/08/10     "LEA765"
    "ICT001"          "Databses"          20/08/10     "ICT218"
    "Hu002"          "Intro to History"     20/01/10     "HI154"
    "Phy003"          "Intro to Physics"     20/02/10     "Phy005"
    "LAW154"          "Intro to Law"          20/08/10     "Law001"
    "PSY154"          "Intro to Psychology"     20/08/10     "PSY001"
    "ICT009"          "Principles Of Computer Science"     20/08/10     "ICT104"
    "Bio007"          "Intro to Biology"     20/08/10     "BIO457"
    "Met008"          "Intro to Metalogy"     20/08/10     "Met432"
    Desc BookOrder
    "REQUIREDBOOKNO"     "BOOKSORDERED"     "RECOMMENDEDTEXTNO"     "ORDERFILLED"     "ORDERNOTFILLED"     "UNITOFFERINGID"     "ISBNNUMBER"     "BOOKTITLE"
    "9812345678908745"          100     "763456723467898"     "Yes"               "No"     "ICT001"               "9780321523068"     "Database Systems"
    "8734567890912344"          150     "876543214567890"     "Yes"               "No"     "ICT009"               "2567458906276"     "Greatest Technology"
    "7348761256789127"          120     "675432189098876"     "Yes"               "No"     "Phy003"               "7653457609825"     "Biggest Atom"
    "6543210956734523"          200     "543216897567123"     "Yes"               "No"     "PSY154"               "4589565321987"     "Greatest Minds Alike"
    "5432178902345783"          250     "476541098765487"     "Yes"               "No"     "LEA011"               "0125678432167"     "WorldWide Legal System"
    "4321987653456980          300     "329876541234598"     "No"     "Yes"     "Hu002"                    "8734512367845"     "Australian History"
    "3215678907653467     "     50     "235671456789087"     "No"               "Yes"     "MA004"                    "9780321523068"     "Intro to Maths"
    "2219876543234785"          350     "827890654321456"     "No"               "Yes"     "Bio007"               "1543278954326"     "Weird Biology"
    "134509845667896     "     400     "138906543251398"     "No"               "Yes"     "ICT001"               "6124537890124"     "Greatest Technology"
    "087235124598776"     500          "097654321901234"     "No"               "Yes"     "Vet006"               "3178765145789"     "WorldWide Legal System"
    "234567890123345"     1000          "765432189034560"     "No"               "Yes"     "ICT001"               "0003456789079"     "Best Databases"
    Desc Book
    "ISBNNUMBER"     "BOOKTITLE"          "AUTHOR"     "REQUIREDTEXT"     "RECOMMENDEDREADING"     "YEAROFPUBLICATION"     "PUBLISHERID"
    "9780321523068"     "Database Systems"     "Connolly and Begg"     "Yes"     "No"                    "2009"          "BBN345"
    "8734512367845"     "Australian History"     "Martin and Malloy"     "Yes"     "No"                    "2005"          "ABD265"
    "4589565321987"     "Great minds alike"     "Sheena Smith"          "Yes"     "No"                    "2003"          "CAR789"
    "7653457609825"     "Biggest Atoms"          "Kevin Smith"          "Yes"     "No"                    "2004"          "ADE498"
    "3178765145789"     "Animal Anatomy"     "Linda Pearce"          "Yes"     "No"                    "2008"          "EAT543"
    "5234569012345"     "Great Maths"          "Ken Morgon"          "No"     "Yes"                    "2006"          "FET987"
    "6124537890124"     "What Metals Can Do"     "Brian Deed"          "No "     "Yes"                    "2007"          "GAT621"
    "1543278954326"     "Weird Biology"          "Shaun Diet"          "No"     "Yes"                    "2002"          "ABC123"
    "2567458906276"     "Greatest Technology"     "Fran Day"          "No"     "Yes"                    "2001"          "ACN456"
    "0125678432167"     "WorldWide Legal System""Claire Dawn"          "No"     "Yes"                    "2000"     "ANB367"
    "0003456789079"     "Best Databases"     "Ken Murray"          "No"     "Yes"                    "2002"          "BBN345"
    Desc TeachingPeriod
    "NAME"     "YEAR"     "STARTDATE"     "TEACHINGPERIODID"
    "S1"     "2010"     17/02/10     "S12010"
    "T1"     "2010"     23/03/10     "T12010"
    "S2"     "2010"     08/08/10     "S22010"
    "SU1"     "2010"     08/01/10     "Su12010"
    "Su2"     "2010"     10/08/10     "Su22010"
    "T2"     "2010"     10/08/10     "T22010"
    "S1"     "2011"     20/02/11     "S12011"
    "S2"     "2011"     20/07/11     "S22011"
    "T1"     "2011"     20/03/11     "T12011"
    "T2"     "2011"     20/08/11     "T22011"
    "SU1"     "2011"     20/02/11     "SU12011"
    "SU2"     "2011"     20/08/11     "SU22011"

  • Is There any difference in Set @Var=ColmnName and Select @Var =Column from Table. I am using it in SSIs for Dynamic Packages

    hey there, Kindly elaborate me the difference Between Set and Select clause while Providing value to a Variable or Even  a  Column.
        Declare @var nvarchar(Max)
        Set @var= (Select TestName+ cAst(TestId as nvarchar) from TblTest where TestID=1)
        Insert into TblTest(TestName)
        Values (@var)
        Declare @var nvarchar(Max)
        Select @var= (Select TestNAme + Cast(TestId as Nvarchar(MAx)) from TblTest Where TestID=1)
        Insert into TblTest(TestName)
        Values(@var)
    Values and result I am getting is Same in Both.
    But just wondering if there is any Difference. and if Any which Should I prefer.
    And Which one uses less Resources.

    I like this article
    http://vyaskn.tripod.com/differences_between_set_and_select.htm
    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

  • Get min and max for a column from table with 24 million rows.

    What is the best way to re-write the following query in a procedure for the table which has around 24 million rows?
    SELECT MIN(ft_src_ref_id), MAX(ft_src_ref_id )
    INTO gn_Min_ID, gn_Max_ID
    from UI_PURGE_FT;
    Thanks
    Edited by: tcode on Jun 21, 2012 12:31 PM

    Which of the following plan is better, can you please breifly explain?
    Also I need to gather statics to know recursive calls , db block gets ,consistent gets etc. etc. how can I get that?
    Thanks
    1.
    Execution Plan
    Plan hash value: 3702745568
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 6 | 13991 (2)| 00:02:48 |
    | 1 | SORT AGGREGATE | | 1 | 6 | | |
    | 2 | INDEX FAST FULL SCAN | UI_PURGE_FT_PK | 23M| 136M| 13991 (2)| 00:02:48 |
    2.
    Execution Plan
    Plan hash value: 1974183109
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | | 2 (0)| 00:00:01 |
    | 1 | SORT AGGREGATE | | 1 | 6 | | |
    | 2 | INDEX FULL SCAN (MIN/MAX)| UI_PURGE_FT_PK | 23M| 136M| 2 (0)| 00:00:01 |
    | 3 | SORT AGGREGATE | | 1 | 6 | | |
    | 4 | INDEX FULL SCAN (MIN/MAX)| UI_PURGE_FT_PK | 23M| 136M| 2 (0)| 00:00:01 |
    | 5 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
    ---------------------------------------------------------------------------------------------

  • How to get  only latest date and other columns from table

    Hi,
    Table
       id          name        date
      123        a             2/3/2010
      124        b            15/2/2010
      125        c             1/1/2010
      123        a             12/4/2010
      125        c             17/2/2010
    this is a table, here id,name,date is composite key.
    I want to select id,name and date so that latest date (e.g., for id 123 date 12/4/2010 be selected) is selected for each id and each id and name should be selected once.
    So what will be its query?
    Thanks

    Hi,
    user12222356 wrote:
    SQL> select id id,name name,max(dt) over 0 from temp2;
    select id id,name name,max(dt) over 0 from temp2
    ERROR at line 1:
    ORA-00923: FROM keyword not found where expectedWhat is over 0?That should be
    ... OVER ( )with a pair of parentheses.
    Almost all aggregate functions (including MAX) also have analytic counterparts. The parser knows that you're using the analytic version if the keyword OVER, followed by an analytic clause in parentheses, comes after the argument. In this case, the default analytic clause is being used, so there's no need to put anything in the parentheses, but syntax still requires that they be there.

  • Web ADI Error when using column from table which can be NULL as parameter

    Hi
    We have a custom integrator which queries the records and downloads into excel sheet. There is parameter list attached to it. One of the parameter is on a field which can have NULL. When we try running the ADI , we are getting the error :
    Fatal error: Please have your system administrator view the bne.log file.
    java.lang.NullPointerException
    Please contact your support representative
    Please help.
    Regards,
    Pradeep.

    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Stefan Misch ([email protected]):
    Yep - if you try:
    create unique index XAK2_A_ARTIKEL
    on A_ARTIKEL(CUST_ID, EXTERNAL_ID);
    I get error ORA-01452, because of duplicate keys. I verified, that within a each CUST_ID, there is no duplicate non-null EXTERNAL_ID, but there are lots of rows for each CUST_ID where EXTERNAL_ID is NULL.
    Thanks for your help.
    Stefan<HR></BLOCKQUOTE>
    Create a view on your table, that you will use for inserts.
    Then, create a trigger INSTEAD OF INSERT on your view. You can perform the checks for uniqueness in it...
    Hope this will help...
    Thomas.
    null

Maybe you are looking for