Plz convert this SQL code to ORALCE

select title,
case when right(title , 2) = 12 then cast(left(title,2) + 1 as varchar(2)) + cast('01' as varchar(2))
else title + 1 end next_title ,
case when right(title,2) = '01' then cast(left(title,2) - 1 as varchar(2)) + cast('12' as varchar(2))
else title - 1 end prev_title
from strdc_admin.st_glt_shipment
group by title
order by title

Hi,
Wouldn't it be better if you first explained what this is supposed to do:
  select title
        ,case
            when right(title, 2) = 12
            then
               cast(left(title, 2) + 1 as varchar(2)) + cast('01' as varchar(2))
            else
               title + 1
         end
            next_title
        ,case
            when right(title, 2) = '01'
            then
               cast(left(title, 2) - 1 as varchar(2)) + cast('12' as varchar(2))
            else
               title - 1
         end
            prev_title
    from strdc_admin.st_glt_shipment
group by title
order by titleI mean, there seems to be some confusion about data types. First you have
when right(title, 2) = 12which indicates title is numeric.
Later on you have
when right(title, 2) = '01'which indicates that title is of char type.
(My guess is that right and left are like substr with positive and negative positions)
Next you have
cast(left(title, 2) + 1 as varchar(2)) + cast('01' as varchar(2))First part, seems to indicate that title is numeric, but what does the second + mean. Is that concatenation?
If not, you have some really confusing implicit type conversions.
And why do you do this:
cast('01' as varchar(2))'01' is already of char datatype, so why cast it?
Please return once you have worked a little more on your question.
Regards
Peter

Similar Messages

  • Hi all Plz convert this SQL code to ORACLE

    -- Insert Not Available Record
    set identity_insert Dim_Region on
    if not exists ( select 'x' from Dim_Region where Region_Id = 99999 and Region = '#NA#' )
    Begin
    insert into Dim_Region (Region_Id , Region , Region_Description , Process_Date ) values
    (99999 , '#NA#' , 'Not Available' , getdate())
    End
    set identity_insert Dim_Region off

    Hi,
    I am not sure what is getdate() I have assumed it to be a function which returns date.
    Hopefully this is what you want a Procedure called "identity_insert Dim_Region"
    create procedure identity_insert Dim_Region is
         cursor c_exists is
              select 'x' from Dim_Region where Region_Id = 99999 and Region = '#NA#';
        v_var char (1);
        v_date date;
    begin
         open c_exists;
         fetch c_exists into v_var;
         if c_exists%notfound then
             v_date := getdate ();
             insert into Dim_Region
                (Region_Id , Region , Region_Description , Process_Date )
             values
                (99999 , '#NA#' , 'Not Available' , v_date);
        end if;   
        close c_exists;
    end;Best Regards
    Arif Khadas

  • Converting application SQL code

    I see that the migration workbench will convert stored procedures. Are there any tools that will help to sniff out or convert application SQL code for MS SQL into SQL supported by Oracle. I am converting from SQL Server 7 to Oracle 8i. Any help would be appreciated

    Hello,
    Yes it probably will return multiple rows...but I spot this:
    CURSOR c_schemas IS
    select owner from <table>@<db-link> where table_name = 'DDL_LOG' and num_rows > 0 order by owner;
    Does that cursor return multiple rows as well? Or just one? Because if it returns more rows you'll get multiple SQL statements...
    Good links?? There is APEX documentation in your installation directory...
    Just try the different kinds of regions I suggested, see if it works and what fits your needs the best.
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    http://www.bloggingaboutoracle.org/
    http://www.logica.com/

  • Plz corrct this alv code

    hi all,
    plz correct this revert back whan i executing every time it will show internal table itab is no long enough.
    plz rectify the errirs and send back it.
    ABLES:     zfm_kfz.
    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.
    DATA : BEGIN OF ITAB OCCURS 0,
           KFZNR LIKE ZFM_KFZ-KFZNR,
           GERAET LIKE ZFM_KFZ-KFZNR,
           KOSTENTRAEGER(10) TYPE C,
           BEZEICHNUNG(10) TYPE C,
           TUVDATUMMMYYYY(6) TYPE C,
           ASUDATUMMMYYYY(6) TYPE C,
           KMSTAND(6) TYPE C,
           HISTO(1) TYPE C,
           REIFEN(1) TYPE C,
           USERNAME(12) TYPE C,
           END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0.
            INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB1.
    DATA: BEGIN OF ITAB_FIELDCAT OCCURS 0.
            INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB_FIELDCAT.
    DATA: T_KFZ LIKE TABLE OF ZFM_KFZ.
    *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   = 'kfznr'.
      fieldcatalog-seltext_m   = 'kfznr'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 11.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'geraet'.
      fieldcatalog-seltext_m   = 'geraet'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'kostentraeger'.
      fieldcatalog-seltext_m   = 'kostentraeger'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'bezeichnung'.
      fieldcatalog-seltext_m   = 'bezeichnung'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'tuvdatummmyyyy'.
      fieldcatalog-seltext_m   = 'tuvdatummmyyyy'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'asudatummmyyyy'.
      fieldcatalog-seltext_m   = 'asudatummmyyyy'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'kmstand'.
      fieldcatalog-seltext_m   = 'kmstand'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'histo'.
      fieldcatalog-seltext_m   = 'histo'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 1.
    fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'reifen'.
      fieldcatalog-seltext_m   = 'reifen'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'username'.
      fieldcatalog-seltext_m   = 'username'.
      fieldcatalog-col_pos     = 9.
      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                = itab1
           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 * from zfm_kfz
      into table itab where kfznr = itab-kfznr.
    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 itab 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.

    Hi,
    Change this..
    DATA : BEGIN OF ITAB ,
    KFZNR LIKE ZFM_KFZ-KFZNR,
    GERAET LIKE ZFM_KFZ-KFZNR,
    KOSTENTRAEGER(10) TYPE C,
    BEZEICHNUNG(10) TYPE C,
    TUVDATUMMMYYYY(6) TYPE C,
    ASUDATUMMMYYYY(6) TYPE C,
    KMSTAND(6) TYPE C,
    HISTO(1) TYPE C,
    REIFEN(1) TYPE C,
    USERNAME(12) TYPE C,
    END OF ITAB.
    DATA: BEGIN OF ITAB1 OCCURS 0.
    INCLUDE STRUCTURE ITAB.
    DATA: END OF ITAB1.
    DATA: ITAB_FIELDCAT type SLIS_T_FIELDCAT_ALV .
    and also use CAPS for field names.
    fieldcatalog-fieldname = '<b>KFZNR</b>'.
    fieldcatalog-seltext_m = 'kfznr'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 11.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    fieldcatalog-do_sum = 'X'.
    fieldcatalog-no_zero = 'X'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    Regards
    vijay

  • Need help converting this html code into code that will work as a flash button

    I have some html code that is for a button in html that when
    pressed sends you to a certain url but also somehow adds an 'id
    value' and a 'website value'.
    How can I convert this code and or put it into a flash
    button?
    Disregard the gif info...that's just for the html graphic
    that goes for the button.
    [HTML]<form
    action="https://secure.verotel.com/cgi-bin/vtjp.pl"
    method="post">
    <input type=hidden name=verotel_id
    value="9804000000840231">
    <input type=hidden name=verotel_website value="55461">
    <center>
    <input type="image" src="
    http://buttons.verotel.com/join/button_00010155461.gif"
    alt="Signup NOW!">
    <img src="
    http://buttons.verotel.com/signup/tbutton_55461.gif"
    border="0" width="1" height="1" alt="">
    </center>
    </form>[/HTML]

    What you want to do might look something like this:

  • How to convert pl/sql code into java/j2ee

    Hi,
    We have a PL/SQL Oracle App server application that we will support if we can convert in j2ee/java. But when i did take a look at the code, these pl/sql contains all HTML and java code inside the stored procedures.
    And iam looking to explore some tools and mechanisms that can convert these pl/sql in a JAVA application so that i can deploy this new app into my BEA81 environment.
    Does any body has any idea:
    a) How to convert from pl/sql > java ?
    b) Any plugins or tools of BEA that can run these pl/sql (the way thay are currently...i.e w/o converting) in BEA 81 container ?
    thanks, sangita

    these pl/sql contains all HTML and java code insideJava or JavaScript. They are not the same. I wouldn't expect to see Java inside html, whereas JavaScript would be intermixed. On the other hand you might have a java stored proc (Oracle 9/10) which is generating HTML.
    >
    Does any body has any idea:Refactor.
    I doubt it just has html and JavaScript/Java. So what you have is a mess that mixes several things that should have been seperate in the first place.

  • How to convert this SQL query to PL/SQL

    I basically need to create an anonymous block that will display each student's first name, last name and the count of students who scored less on test 1 than the student.
    So basically we need to find the count of students who have scored less than that particular student and we do it for all students in the table.
    So for this particular query i designed my code in SQL
    select g1.gr_fname, g1.gr_lname, count(*)
    from grade g1, grade g2
    where g1.gr_t1 > g2.gr_t1 and
    g1.std_code = g2.std_code
    group by g1.gr_fname, g1.gr_lname;
    But i am unable to get the logic as to how to execute it in PL/SQL,I am missing something a minor detail to execute the same in PL/SQL
    could someone please help me with the logic.
    Thanks

    Hi welcome to the forum try some thing below
    SQL> DECLARE
      2     CURSOR c1
      3     IS
      4        SELECT   ename, sal, d.deptno
      5            FROM scott.emp e, scott.dept d
      6           WHERE e.deptno = d.deptno
      7        GROUP BY ename, sal, d.deptno;
      8  BEGIN
      9     FOR c2 IN c1
    10     LOOP
    11        DBMS_OUTPUT.put_line ('name is  ' || c2.ename);
    12     END LOOP;
    13  END;
    14  /
    name is  CLARK
    name is  KING
    name is  JONES
    name is  MARTIN
    name is  FORD
    name is  SCOTT
    name is  ALLEN
    name is  TURNER
    name is  WARD
    name is  MILLER
    name is  ADAMS
    name is  BLAKE
    name is  JAMES
    name is  SMITH
    PL/SQL procedure successfully completed.This is just to demonstrate the use of PL/SQL block

  • Convert this sql server query to Oracle?

    I've some SQL Server queries that I need to make a copy for to run against Oracle databases. (10G), any help would be appreciated.
    SELECT COUNT(*) COUNT, CONVERT(DATETIME, CONVERT(VARCHAR(8), M.START_DATE, 1)) [DATE]
         FROM OPTC.ORD_M_ORDER M
         INNER JOIN OGEN.GEN_M_PATIENT_MAST P ON M.PAT_NUMBER = P.PAT_NUMBER
         INNER JOIN OPTC.ORD_C_ORDER_TYPE C ON C.ORDER_TYPE_KEY = M.ORDER_TYPE_KEY
         WHERE OGEN.DATEONLY(END_DATE)- OGEN.DATEONLY(START_DATE) < '1900/03/01'
         --AND OGEN.DATEONLY(CREATED_ON) = OGEN.DATEONLY(CURRENT_TIMESTAMP)
         AND ORDER_STATUS IN (4,7,8)
         AND M.FACILITY_KEY IN (SELECT VALUE FROM OGEN.COMMA_TO_TABLE(@FACILITYKEY))
         AND [START_DATE] BETWEEN @STARTDATE AND @ENDDATE
         AND CAST(M.ORDER_FLAGS AS BIGINT) & 64 <> 64 AND P.DISCHARGE_DATE IS NULL
         GROUP BY CONVERT(DATETIME, CONVERT(VARCHAR(8), [START_DATE], 1))

    Hi,
    You could use the 'Translation Scratch Editor' in SQL*Developer to translate SQL*Server statements to Oracle.
    SQL*Developer is free and can be downloaded from here -
    http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html
    Once installed start it up, then go to 'Tools' - 'Migration' - 'Translation Scratch Editor'
    I did run the statement you have posted here through it but it gave errors so looks like there may be a problem with the syntx in any case.
    Does this query run as it is in SQL*Server ?
    Regards,
    Mike
    Edited by: mkirtley on Jan 5, 2012 12:45 PM

  • Help plsss converting this AS2 code to AS3!!

    here is a little AS2 code that is in fact a photo gallery
    that i use in my site and i want to convert it to AS3 but i just
    cant seem to get it right... could someone plssss help me?!?!

    with what part are you having trouble?

  • How to write this sql code ?

    for example below shows:
    create table temp
    order_type varchar2(30),
    order_num number);
    insert into temp values('apple',000001);
    insert into temp values('banana',000002);
    insert into temp values('chair',000003);
    select *
    from temp
    where instr(order_type,decode(x,1,'a',2,'b',2,'c',order_type)) >0
    if i let x equals 2 and i want to get b and c from above querying .
    why above query could not get 'c' and only get 'b' if i give 2 to x ?
    how to write above select clause ?
    who can help me ?
    thanks!

    Decode will return the first match;
    SQL> select decode(2,1,'a',2,'b',2,'c')
    from dual
    D
    b
    1 row selected.This may help;
    old: select *
    from temp
    where regexp_like(order_type, case to_number(&x)
                                     when 1 then 'a'
                                     when 2 then 'b|c'
                                  end)
    new: select *
    from temp
    where regexp_like(order_type, case to_number(2)
                                     when 1 then 'a'
                                     when 2 then 'b|c'
                                  end)
    ORDER_TYPE                      ORDER_NUM
    banana                                  2
    chair                                   3
    2 rows selected.

  • Trying to convert this sql into a crystal report

    Post Author: ru4real
    CA Forum: General
    I have this statement provided to extract via sql but i cannot emulate this in crystal.  can anybody help?  here is the run down.  essentially iam trying to list records in one table auanmast which is not present in the other table auanregs based on reg dte (from) and reg til (to)  if this record is not in the auanreg table then list the ani_num from the auanmast.  (however there is not a null field present in the auanreg table), so a left outerjoin won't work.
    ani_num      reg_date    reg_til
    5555           01/07/08    30/06/09
    5555           01/07/05     30/07/06
    so the record missing in auanreg is reg_date 01/07/07  and reg_til = 30/06/08 and iam trying to get the query to list all ani_num from auanmast that have no date assigned with reg_date & reg_til date the link being ani_num to 
    select ani_num  from auanmast a  where ani_num not in (select ani_num                        from auanregs                        where reg_dte = '01-Jul-07'                        and reg_til = '30-Jun-08'                        and ani_num = a.ani_num)  and ani_dth is null  and ani_dep is null and ani_num not in (select ani_num                     from auantags                     where ani_num = a.ani_num                     and tag_set != '2007/08')  order by ani_num /
    Hope someone is upto the challenge for this one....cheers

    Post Author: V361
    CA Forum: General
    Have you tried adding a command.  Go to select datasource, select command, you should be able to use the SQL there.  ( OF course it won't be just copy and paste ) unless you are lucky.

  • I need help plz with this easy code

    The output shows null in the frame ,, no buttons no areas or fields .. plz help ASAP
    import java.awt.* ;
    import javax.swing.* ;
    public class GUI extends JFrame{
        public void function (){
             setSize(500,500);
             setTitle("SokAndO");
             Container first = this.getContentPane();
             JButton _send = new JButton ("Send") ;
             JTextField _text = new JTextField () ;
             JTextArea _history = new JTextArea (100,100);
             JPanel p1 = new JPanel();
             JPanel p2 = new JPanel();
             JPanel p3 = new JPanel();
             p1.add(_send);
             p2.add(_history);
             p3.add(_text);
                first.setLayout (new FlowLayout());
             setVisible(true);
             public static void main(String arg[]){
              GUI lol=new GUI();
              lol.function();
    }

    and wht is the use of this statment ???
    Container first =
    this.getContentPane();With this statement you have a variable first that refers to the JFrame's contentPane, but as noted above, you do nothing with it. You need to look at Swing examples on how to add components to JPanels and such. The Sun tutorials should be a good place to start.

  • How to get better performance to this sql code?

    Guys I need your help.
    I have a master table, 80 columns, more than millions data in it.
    MasterTable
    PK_Column_1
    PK_Column_2
    Column_3
    Column_4
    Select column_3, column_4
    from MasterTable
    where PK_Column_1 = '1' and PK_Column_2 = '2';
    I don't know how to create index for this table. Thank u.

    I don't know how to create index for this table.If PK stands for Primary Key, there should already be an index on those columns.
    What trouble are you having? Have you looked at an explain plan?
    Also...
    PK_Column_1 = '1' Are your primary key columns varchar2 columns?

  • How to convert this VB code into c#

    Public Property Cell(ByVal row_index As Integer, ByVal col_index As Integer) As Object
    Get
    Return _excel.Cells(row_index, col_index).value
    End Get
    Set(ByVal value As Object)
    _excel.Cells(row_index, col_index).value = value
    End Set
    End Property
    Thanks.

    If you want to have a property called Cell that returns excel's Cells collection (which is a Range) then just do this:
    public Range Cells
    public get
    return _excel.Cells;
    // Range is accessed by .Cells
    // Range has an index operator [,]
    // so you can access .Cells[row,col]
    If you want to intercept the indexing, then you must return a object that proxies the indexing.
    class MyRange
    public MyRange( Range range ) { this.range = range; }
    Range range;
    // This just might be the syntax you're actually looking for
    public object this[int row, int col]
    get {
    return range[row,col];
    set
    range[row,col] = value;
    public MyRange Cells
    get {
    return new MyRange( _excel.Cells );

  • How do I get rid of this sql warning?

    Hi folks,
    I am running oracle 10.2.0 on Linux. I would like to get rid of this sql code warning
    (Warning(151,3): PLW-07202: bind type would result in conversion away from column type)I get when I compile the code below. Basically Oracle does not like the idea of using a number in an expression with sysdate. eg (sampling_date < sysdate - p_n_value) where p_n_value is a number;
    What is the best way to do this?
    CREATE TABLE "USERDATA"."TBL_SESSION_SQL_WAIT_HISTORY"
       (           "SESSION_SQL_WAIT_HIST_SEQ_ID" NUMBER,
                    "DBID" NUMBER,
                    "SID" NUMBER,
                    "SEQ#" NUMBER,
                    "EVENT" VARCHAR2(64 BYTE),
                    "P1TEXT" VARCHAR2(64 BYTE),
                    "P1" NUMBER,
                    "P1RAW" RAW(8),
                    "P2TEXT" VARCHAR2(64 BYTE),
                    "P2" NUMBER,
                    "P2RAW" RAW(8),
                    "P3TEXT" VARCHAR2(64 BYTE),
                    "P3" NUMBER,
                    "P3RAW" RAW(8),
                    "WAIT_TIME" NUMBER,
                    "SECONDS_IN_WAIT" NUMBER,
                    "STATE" VARCHAR2(19 BYTE),
                    "SAMPLING_DATE" DATE,
                    "SAMPLING_TIME" VARCHAR2(8 BYTE),
                    "SERIAL#" NUMBER,
                    "USERNAME" VARCHAR2(30 BYTE),
                    "OSUSER" VARCHAR2(30 BYTE),
                    "PADDR" RAW(4),
                    "LOGON_TIME" DATE,
                    "PROCESS" VARCHAR2(24 BYTE),
                    "SQL_HASH_VALUE" NUMBER,
                    "SADDR" RAW(4),
                    "MODULE" VARCHAR2(48 BYTE),
                    "ROW_WAIT_OBJ#" NUMBER,
                    "ROW_WAIT_FILE#" NUMBER,
                    "ROW_WAIT_BLOCK#" NUMBER,
                    "ROW_WAIT_ROW#" NUMBER
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 16384 NEXT 65536 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERDATA" ;
      CREATE TABLE "USERDATA"."TBL_SQLTEXT_WAIT_HISTORY"
       (           "SQLTEXT_SEQ_ID" NUMBER,
                    "DBID" NUMBER,
                    "ADDRESS" RAW(4),
                    "HASH_VALUE" NUMBER,
                    "SQL_ID" VARCHAR2(13 BYTE),
                    "COMMAND_TYPE" NUMBER,
                    "PIECE" NUMBER,
                    "SQL_TEXT_PIECE" VARCHAR2(64 BYTE),
                    "SQL_TEXT" VARCHAR2(1000 BYTE),
                    "DISK_READS" NUMBER,
                    "BUFFER_GETS" NUMBER,
                    "DIRECT_WRITES" NUMBER,
                    "PARSE_CALLS" NUMBER
       ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      STORAGE(INITIAL 16384 NEXT 65536 MINEXTENTS 1 MAXEXTENTS 2147483645
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
      TABLESPACE "USERDATA" ;
    create or replace
    PROCEDURE data_coll AS
    p_n_value userdata.tbl_options.n_value%type;  -- number
    BEGIN
    -- irrelevant code here
      select n_value into p_n_value from tbl_options where name ='PURGE_DAY_COUNT';
      DELETE FROM tbl_sqltext_wait_history t where t.hash_value in
        (select s.sql_hash_value from cc_session_sql_wait_history s
        where s.sampling_date < sysdate  - p_n_value
        and s.sql_hash_value = t.hash_value);
      DELETE FROM tbl_session_sql_wait_history
      WHERE sampling_date < sysdate - p_n_value;
    END;Thanks in advance for your feedback.
    rgds, Efachim
    Edited by: efachim on Jan 19, 2009 10:44 AM

    One general suggestion.
    "TBL_SESSION_SQL_WAIT_HISTORY"Did you create your table and column names within double quotes?
    It will make your table as case sensitive.
    Regards.
    Satyaki De.

Maybe you are looking for