Update a table using same variable name as the column

I am not able to update a table column using a local variable which is having same name as the table column. Example of the function is as follows:
create or replace function trial return integer as
column1 integer:=99;
BEGIN
update firsttable set column1=column1 where column2='john';
return 0;
END;
Existing data in firsttable:
COLUMN1 COLUMN2
123 xyz
123 abcd
101 john

Unfortunately table aliasing won't help... Although specifying the procedure will. Somewhat academic I know, since if you can prefix the procedure name on the variable you can just as easily rename it, unless you happen to have a bunch of other code calling it using named notation possibly.
SQL> select ename, comm from emp where empno = 7934;
ENAME            COMM
MILLER
SQL> create or replace procedure new_comm
  2   (empno in number, comm in number)
  3  is
  4  begin
  5      update emp e
  6      set e.comm = new_comm.comm
  7      where e.empno = new_comm.empno;
  8      dbms_output.put_line('updated '||sql%rowcount||' rows!');
  9  end;
10  /
Procedure created.
SQL> exec new_comm (7934, 100)
updated 1 rows!
PL/SQL procedure successfully completed.
SQL> select ename, comm from emp where empno = 7934;
ENAME            COMM
MILLER            100Message was edited by:
3360
Colin beat me to it

Similar Messages

  • Import tables using same file name for all tables

    hi,
    We are using oracle 11.2.0.3.0, we have taken export of multiple tables in schema, unfortunately in exp command we have mention same file name for all the tables, now it has created one file for all export but the size of that file shows that all the tables included in it , when we try to import the tables only last table mention in export command is imported for other tables it hangs, example of code show below.
    Is there any way to import the remaining tables.
    exp system file =exp05042013.dmp tables=gr.table1
    exp system file =exp05042013.dmp tables=gr.table2
    exp system file =exp05042013.dmp tables=gr.table3

    Hi,
    You can use as :
    exp username@database tables=table1,table2 file=tabledata.dmpDid you have any RMAN full backup?
    Why you are not recover crash database?
    Mahir

  • How to Update  crmd_customer_h TABLE Using CRMV_EVENT Through Funtion Module

    Hi
    How we can update customer_h table using the CRMV_EVENT Where i implemented logic below in the Funtion Module.
    data:     lt_doc_flow          TYPE crmt_doc_flow_wrkt,
              lw_cust_h_com        TYPE crmt_customer_h_com,
              lw_input_field_names TYPE crmt_input_field_names,
              lt_input_field_names TYPE crmt_input_field_names_tab,
              lt_objects_to_save TYPE crmt_object_guid_tab,
              lw_guid TYPE CRMT_OBJECT_GUID.
    DATA : lv_process_type TYPE crmt_process_type.
    data: wa_doc_flow type CRMT_DOC_FLOW_WRK.
    data: wa_customer_h type crmd_customer_h.
    *  Function module for retriving the Process type.
      CALL FUNCTION 'CRM_ORDERADM_H_READ_OW'
        EXPORTING
          iv_orderadm_h_guid     = iv_header_guid
        IMPORTING
          ev_process_type        = lv_process_type
        EXCEPTIONS
          admin_header_not_found = 1
          OTHERS                 = 2.
    if lv_process_type eq 'ZG01'.
    CALL FUNCTION 'CRM_DOC_FLOW_READ_OB'
    EXPORTING
       IV_HEADER_GUID                 = iv_header_guid
    IMPORTING
       ET_DOC_FLOW_WRK                = lt_doc_flow.
    read table lt_doc_flow with key objtype_a = 'BUS2000116' INTO wa_doc_flow. "gc_object_type-service.
                if sy-subrc eq 0.                    "set flag for service order
                lw_cust_h_com-ref_guid       =  wa_doc_flow-objkey_a.
                lw_cust_h_com-ZZTRAIL_FLAG   = 'X'.
                 lw_cust_h_com-mode           = 'A'.
                lw_cust_h_com-ref_handle     = '0000000001'.
                lw_guid = wa_doc_flow-objkey_a.
                INSERT lw_guid INTO TABLE lt_objects_to_save.
         endif.
                  lw_input_field_names-fieldname = 'REF_GUID'.
                lw_input_field_names-fieldname = 'ZZTRAIL_FLAG'.
              lw_input_field_names-changeable = ' '.
               INSERT lw_input_field_names INTO TABLE lt_input_field_names.
    Maintain Customer H
             CALL FUNCTION 'CRM_CUSTOMER_H_MAINTAIN_OW'
                  EXPORTING
                    is_customer_h_com    = lw_cust_h_com
                  CHANGING
                    ct_input_field_names = lt_input_field_names
                  EXCEPTIONS
                    header_change_error  = 1
                    header_create_error  = 2
                   error_occurred       = 3.
    ENDIF.
    *endif.
    *Clearing local variables
      clear: lv_process_type,
             lw_cust_h_com,
             lw_input_field_names.
    *Free internal tables
      free: lt_doc_flow,
            lt_input_field_names.

    Hi Faisal
    I think your not clear with what i am saying anyhow i will again explain you my requirement
    As per my requirement
    1)in the service order search report i need to add a field called "Has trail order with No Follow up" with values "Yes" & "Blank"
    For above Field i added  using the structure CRMST_QUERY_SRVO_BTIL and through configuration i am able to display the field in webui as per (Attachement Pic 1)
    2)When i  search with search criteria as  "Has trail order with No Follow up" with  "Yes"
    Then in result list i need to show the service order those having follow up as trail orders(sales order) only.if for  next document trail order  having any follow up then those service orders dont want to show in result list.
    For above requirement i implemented F.M using CRMV_EVENT & I configured for BUS2000115 And BEFORE_SAVE The Order
    The FM Will get trigger when i save the service order and for that service order if create any follow up and try to save the trail order then This FM Will trigger and in this i am doing validations.
    3)Add one AET Trail Flag field is added under CUSTOMER_H Table.
    4)in the FM I am validating for if the trail order having the preceding document as service order then i need to make flag as "X" For that service order in customer_h
    if suppose when i delete trail order from the service order then that flag must need to be "unset" from the CUSTOMER_H.
    Why bcoz we are doing above process is do show records in result list based on Flag values
    these flag checks are validating in the BADI Which we implemented for search logic.
    Please refer below Login for my requirement:-
    Proposal to have a custom “flag” field (background at table level,
         crmd_customer_h) linked to service order which gets flagged whenever at
         least one Trial order is created and saved from the Service Order.
    The flag value should be cleared when all the trial orders created and
    saved as follow up transactions are deleted from the system.
    Similarly for Trial Orders will use the same custom “flag” field
         which gets activated when at least one follow up is created and saved from Trial Order.
    The flag value should be cleared when all the follow up transactions from
    the Trial Order are deleted from the system.
    When the above search criteria “Has Trial order with no follow up”
         “is” “Yes” is applied then the logic derives all the service
         orders which satisfy additional search criteria applied in the search and
         for these Service orders checks if the custom flag field is checked to
         derive all Service orders which have Trial order. The custom flag values
         values are derived from crmd_customer_h table in CRM.
    4 )Further for all the Trial Orders determined in Step 3
    check if the Trial Order has a follow up by checking if the custom flag field
    is checked. The custom flag values are derived from crmd_customer_h table in
    CRM.
    5) If step 4 is not met populate the preceding Service
    Orders in the Result list

  • If variable name is the same as the column name in procedure ?

    If variable name is the same as the column name in procedure , What should i do?
    For Example :
    CREATE OR REPLACE PROCEDURE "TEST_PROC" (MIN_SALARY in UMBER)
    as
    begin
    INSERT INTO TEST SELECT JOB_ID,MIN_SALARY FROM JOBS WHERE MIN_SALARY = MIN_SALARY;
    end;

    You could follow a better naming convention and have the parameters to the procedures named in a way so as not to be confused with column names.
    You could prefix the variable names with the name of the procedure they appear in but then what if your have procedure names same as table names?
    SQL> create or replace procedure test_proc(sal in number) is
      2    cnt number ;
      3  begin
      4    select count(*) into cnt from scott.emp where scott.emp.sal = test_proc.sal ;
      5    dbms_output.put_line('cnt='||cnt) ;
      6  end ;
      7  /
    Procedure created.
    SQL> set serveroutput on
    SQL> exec test_proc(800) ;
    cnt=1
    PL/SQL procedure successfully completed.
    SQL>If you search you can find several posts here itself on naming convention to avoid such issues in first place.

  • Code to update a table using sqlldr

    Hi all,
    can anybody give the code to update a table using sqlldr with an example
    thank you

    You want add the new line and modified the existing line (based on empno) from file e:\scripts\sql\emp2_ext.dat into table emp2 :
    7782,CLARK,MANAGER,7839,09/06/81,80000,,10
    8000,ORACLE,DATABASE,,11/02/07,99999,,20Then :
    SQL> conn system/mypwd
    Connected.
    SQL>
    SQL> create directory my_dir as 'e:\scripts\sql';
    Directory created.
    SQL>
    SQL> grant read,write on directory my_dir to scott;
    Grant succeeded.
    SQL>
    SQL> conn scott/mypwd
    Connected.
    SQL> create table emp2_ext
      2  (EMPNO    NUMBER(4),
      3   ENAME    VARCHAR2(10),
      4   JOB      VARCHAR2(9),
      5   MGR      NUMBER(4),
      6   HIREDATE DATE,
      7   SAL      NUMBER(7,2),
      8   COMM     NUMBER(7,2),
      9   DEPTNO   NUMBER(2)
    10  )     
    11  ORGANIZATION EXTERNAL
    12  ( TYPE ORACLE_LOADER
    13    DEFAULT DIRECTORY my_dir
    14    ACCESS PARAMETERS
    15    ( records delimited by newline
    16      badfile my_dir:'emp2_ext.bad'
    17      logfile my_dir:'emp2_ext.log'
    18      fields terminated by ','
    19      missing field values are null
    20      ( empno, ename, job, mgr, hiredate char date_format date mask "dd/mm/yy",
    21        sal, comm, deptno
    22      )
    23    ) LOCATION ('emp2_ext.dat')
    24  ) ;
    Table created.
    SQL>
    SQL> select * from emp2_ext;
         EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09/06/81      80000                    10
          8000 ORACLE     DATABASE             11/02/07      99999                    20
    SQL> select * from emp2;
         EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09/06/81      24500                    10
          7839 KING       PRESIDENT            17/11/81      50000                    10
          7934 MILLER     CLERK           7782 23/01/82      13000                    10
    SQL> merge into emp2 a
      2  using (select * from emp2_ext) b
      3  on    (a.empno=b.empno)
      4  when matched then update set a.ename=b.ename,
      5                               a.job=b.job,
      6                               a.mgr=b.mgr,
      7                               a.hiredate=b.hiredate,
      8                               a.sal=b.sal,
      9                               a.comm=b.comm,
    10                               a.deptno=b.deptno
    11  when not matched then insert (a.empno, a.ename, a.job, a.mgr, a.hiredate, a.sal, a.comm, a.deptno)
    12                        values (b.empno, b.ename, b.job, b.mgr, b.hiredate, b.sal, b.comm, b.deptno);
    2 rows merged.
    SQL>
    SQL> select * from emp2;
         EMPNO ENAME      JOB              MGR HIREDATE        SAL       COMM     DEPTNO
          7782 CLARK      MANAGER         7839 09/06/81      80000                    10 --modified line
          7839 KING       PRESIDENT            17/11/81      50000                    10
          7934 MILLER     CLERK           7782 23/01/82      13000                    10
          8000 ORACLE     DATABASE             11/02/07      99999                    20 --added line
    SQL> HTH,
    Nicolas.
    Well, Hans has already give good explanation with docs links...
    Message was edited by:
    N. Gasparotto

  • Use a variable name within a function?

    here's my function....
    myInterval = setInterval (TTMO,15);
    function TTMO () {
    InstanceNameOfMovieClip._x -= (InstanceNameOfMovieClip._x -
    _xmouse)/10;
    InstanceNameOfMovieClip._y -= (InstanceNameOfMovieClip._y -
    _ymouse)/10-2;
    instead of using the "InstanceNameOfMovieClip" can i use a
    variable name? i've tried, but it doesn't work. i also tried using
    the correct hierarchy too, such as this._parent.VariableName
    too.

    you need to concat the linkage to the movieclip using your
    string variable like this
    var mcName_str = "bigBox_mc";
    this[mcName_str]._x = 20;
    you can use this method for looping through incrementally
    named objects
    for(var i:Number=0;i<10;i++)
    this["mc"+i]._x = 20;
    hope that helped

  • Updating EKKO table using E1BPPAREX

    Hi all,
    My requirement is to update ekko table using E1BPPAREX segement. I have gone through so many posts regarding this.
    In my case, PO number is not yet created. I am using BAPI_PO_CREATE1 for creating this . From PI side, if they pass the custom field value in the appropriate postion of VALUEPART field of E1BPPAREX, will it get updated to the ekko table automatically.
    Regards,
    Sajith

    Hi Sajith,
      you have to do is populate structure extensionin. You'll have to implement the fm DDIF_NAMETAB_GET to look for the right place (offset) in order to add the field on the structure extension in.
    Example:
      CALL FUNCTION 'DDIF_NAMETAB_GET'
        EXPORTING
          tabname   = c_ext_table   --> ''BAPI_TE_MEPOHEADER
        TABLES
          dfies_tab = lt_tab
        EXCEPTIONS
          not_found = 1
          OTHERS    = 2.
      CLEAR l_offset.
      LOOP AT lt_tab.
        CASE lt_tab-fieldname.
          WHEN c_yourfield.
            w_extin-valuepart1+l_offset = p_yourfield.
        ENDCASE.
        ADD lt_tab-leng TO l_offset.
      ENDLOOP.
      MOVE c_ext_table TO w_extin-structure.
      APPEND w_extin TO p_i_extin.
    Regards,
    Carlos.

  • Updating multiple tables using JDBC Adapter

    Hi,
    I am trying to insert/update multiple tables using one message via JDBC adapter. The following is the message being posted. However, only the first statement was executed. Anything wrong?
    Thanks in advance!
    Hart
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration"><DeliveryData><DelHeader action="UPDATE_INSERT"><table>DelHeader</table><access><DelNo>0080000230</DelNo><DelType>LF</DelType><XOverwrite>X</XOverwrite><ShipTo>0000000026</ShipTo><SoldTo>0000000026</SoldTo><Priority>00</Priority><DocDate>02/17/2007</DocDate><GText>CIF Test</GText><DelDate>02/20/2007</DelDate><PickDate>02/20/2007</PickDate><ShipPoint>NO02</ShipPoint><PackCount>00000</PackCount></access><key><DelNo>0080000230</DelNo></key></DelHeader>
    <DelItem action="INSERT"><table>DelItem</table><access><DelNo>0080000230</DelNo><ItemNo>000010</ItemNo><GText>10# GRAN-GREAT VALUE</GText><Material>G04410G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BL</UOM></access><access><DelNo>0080000230</DelNo><ItemNo>000020</ItemNo><GText>25# GRAN- GREAT VALUE</GText><Material>G04025G611</Material><Plant>6005</Plant><SLoc>6005</SLoc><RefDoc>mmenon32</RefDoc><RefItem>00000000</RefItem><DelQty>5.000</DelQty><UOM>BG</UOM></access></DelItem></DeliveryData></ns0:DeliveryDBUpdate>

    Hi,
    You need 2 STATEMENT level tags,
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:DeliveryDBUpdate xmlns:ns0="http://test.com/r3_integration">
    <b><DeliveryData1></b>
    <DelHeader action="UPDATE_INSERT">
    <table>DelHeader</table>
    <access>
    <DelNo>0080000230</DelNo>
    <DelType>LF</DelType>
    <XOverwrite>X</XOverwrite>
    <ShipTo>0000000026</ShipTo>
    <SoldTo>0000000026</SoldTo>
    <Priority>00</Priority>
    <DocDate>02/17/2007</DocDate>
    <GText>CIF est</GText>
    <DelDate>02/20/2007</DelDate>
    <PickDate>02/20/2007</PickDate>
    <ShipPoint>NO02</ShipPoint>
    <PackCount>00000</PackCount>
    </access>
    <key>
    <DelNo>0080000230</DelNo>
    </key>
    </DelHeader>
    <b><DeliveryData1></b>
    <b><DeliveryData2></b>
    <DelItem action="INSERT">
    <table>DelItem</table>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000010</ItemNo>
    <GText>10# GRAN-GREAT VALUE</GText>
    <Material>G04410G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BL</UOM>
    </access>
    <access>
    <DelNo>0080000230</DelNo>
    <ItemNo>000020</ItemNo>
    <GText>25# GRAN- GREAT VALUE</GText>
    <Material>G04025G611</Material>
    <Plant>6005</Plant>
    <SLoc>6005</SLoc>
    <RefDoc>mmenon32</RefDoc>
    <RefItem>00000000</RefItem>
    <DelQty>5.000</DelQty>
    <UOM>BG</UOM>
    </access>
    </DelItem>
    <b></DeliveryData2></b>
    </ns0:DeliveryDBUpdate>
    Try with such a strcuture and let us know if it works.
    Regards
    Bhavesh

  • Update a table using MODIFY

    Hi,
    We need your help.
    We want to update a table using the MODIFY command but it does not delete the previous entries instead it INSERTs a new entry.
    Scenario:
    1. Upon calling the Screen for Editing the entry, the previous entry must be deleted
    2. When SAVEd, the new entry must replace the previous entry.

    Make sure that in the definition or your table you have specified the key. Otherwise, the system may "think" that all the fields are part of the key, therefore all lines are different.
    This is a extract from SAP's documentation:
    "The line to be changed is determined by the fact that the content of the table key matches the content of the corresponding components in the wa work area. For tables with a key that is not unique, the first entry that is found is changed. "
    Regards.

  • How to select data from a table using a date field in the where condition?

    How to select data from a table using a date field in the where condition?
    For eg:
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
                                                      and bdatu = '31129999'.
    thanks.

    Hi Ramesh,
    Specify the date format as YYYYMMDD in where condition.
    Dates are internally stored in SAP as YYYYMMDD only.
    Change your date format in WHERE condition as follows.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and bdatu = <b>'99991231'.</b>
    I doubt check your data base table EQUK on this date for the existince of data.
    Otherwise, just change the conidition on BDATU like below to see all entries prior to this date.
    data itab like equk occurs 0 with header line.
    select * from equk into table itab where werks = 'C001'
    and <b> bdatu <= '99991231'.</b>
    Thanks,
    Vinay
    Thanks,
    Vinay

  • Could not parse the file contents as a data set. There were too many variable names in the first line of the text file.

    Could not parse the file contents as a data set. There were too many variable names in the first line of the text file.

    What are the Variables settings, what is the text file’s content, …?

  • Select the name of the column in combobox

    Hi !!
    i have already get the name of the columns in a combobox with this code 
    xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
    xlWorkSheet.Activate()
    xlApp.Visible = True
    With xlWorkSheet
    Dim LastCol As Integer = xlWorkSheet.Cells(1, xlWorkSheet.Columns.Count).End(XlDirection.xlToLeft).Column
    For x As Integer = 1 To LastCol
    ComboBox2.Items.Add(xlWorkSheet.Cells(1, x).value)
    Next
    End With
    and what i want is :
    when i select the name of the column :
    -this column will be copie in a new sheet of the same workbook (a new sheet add and the column of the table will be there )
    help me pleasee

    i use tis code 
     Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            Dim Excols As New Dictionary(Of Integer, String)
            xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
            xlWorkSheet.Activate()
            xlApp.Visible = True
            With xlWorkSheet
                Dim LastCol As Integer = xlWorkSheet.Cells(1, xlWorkSheet.Columns.Count).End(XlDirection.xlToLeft).Column
                For x As Integer = 2 To LastCol
                    Excols.Add(x, xlWorkSheet.Cells(1, x).value.ToString)
                Next
                ComboBox2.DataSource = New BindingSource(Excols, Nothing)
                ComboBox2.ValueMember = "Key"
                ComboBox2.DisplayMember = "Value"
                AddHandler ComboBox2.SelectedIndexChanged, AddressOf ComboBox2_SelectedIndexChanged
            End With
        End Sub Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
            Dim exWS2 As Microsoft.Office.Interop.Excel.Worksheet
            xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
            xlWorkSheet.Activate()
            xlApp.Visible = True
            With xlWorkSheet
                Dim key As String = DirectCast(ComboBox2.SelectedItem, KeyValuePair(Of Integer, String)).Key
                Dim value As String = DirectCast(ComboBox2.SelectedItem, KeyValuePair(Of Integer, String)).Value
                Dim lastrow As Integer = xlWorkSheet.Cells.Rows.End(XlDirection.xlDown).Row
                Dim colletter As String = ColumnIndexToColumnLetter(key)
                exWS2 = DirectCast(xlWorkBook.Sheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
                exWS2.Name = value
               xlWorkSheet.Range(colletter & "1:" & colletter & lastrow.ToString).Copy(exWS2.Range("A1"))
                ' xlWorkSheet = DirectCast(xlWorkBook.ActiveSheet, Microsoft.Office.Interop.Excel.Worksheet)
                'exWS2 = DirectCast(xlWorkBook.Sheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
                'exWS2.Cells(1, 1).value = ComboBox2.SelectedItem.ToString
                'exWS2.Name = ComboBox2.SelectedItem.ToString
            End With
            Me.Hide()
            form2.show()
        End Sub
        Private Function ColumnIndexToColumnLetter(ByVal colIndex As Integer) As String
            Dim div As Integer = colIndex
            Dim colLetter As String = String.Empty
            Dim modnum As Integer = 0
            While div > 0
                modnum = (div - 1) Mod 26
                colLetter = Chr(65 + modnum) & colLetter
                div = CInt((div - modnum) \ 26)
            End While
            Return colLetter
        End Functionbut 
    when i click on the button a new sheet add named the first colum and an other sheet add also empty 
    without  choosing an items of the combobox :(
    and  i get an error in this :   exWS2.Name = value
    which is :
    Impossible de renommer une feuille comme une autre feuille, une bibliothèque d'objets référencée ou un classeur
    référencé par Visual Basic.

  • Select the name of the column from sheet Excel

    Hi everyone,
    i use vb.net with excel 
    First, i have a button "browse"
    which open a workbook.
    Second ,i  have a button "get
    the names of the sheets" which give me the name of the sheet in a combobox ,then i choose the sheet.
    Then i have an other button " get
    the column names " which give me the name of the columns of the table in a combobox .
    When i select the name of the column a new sheet add named the
    name of the column and which has the data of this column
    what i want is :
     when i select again the same column a messagebox will
    be shown "you have already select it "
    And when i go back to choose another sheet then another column
    will be open without getting any error
    this is the code of the combobox :
    Public Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
    xlWorkSheet.Activate()
    xlApp.Visible = True
    With xlWorkSheet
    Dim key As String = CStr(DirectCast(ComboBox2.SelectedItem, KeyValuePair(Of Integer, String)).Key)
    Dim value As String = DirectCast(ComboBox2.SelectedItem, KeyValuePair(Of Integer, String)).Value
    Dim lastrow As Integer = xlWorkSheet.Cells.Rows.End(XlDirection.xlDown).Row
    Dim colletter As String = ColumnIndexToColumnLetter(CInt(key))
    exWS2 = DirectCast(xlWorkBook.Sheets.Add, Microsoft.Office.Interop.Excel.Worksheet)
    exWS2.Name = value
    xlWorkSheet.Range("A1:A" & lastrow.ToString).Copy(exWS2.Range("A1"))
    End With
    End Sub
    and if you want to know the code of the button here is :
    Public Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim Excols As New Dictionary(Of Integer, String)
    xlWorkSheet = CType(xlWorkBook.Sheets(ComboBox1.Text), Excel.Worksheet)
    xlWorkSheet.Activate()
    If ComboBox2.Items.Count = Nothing Then
    With xlWorkSheet
    Dim LastCol As Integer = xlWorkSheet.Cells(1, xlWorkSheet.Columns.Count).End(XlDirection.xlToLeft).Column
    For x As Integer = 2 To LastCol
    Excols.Add(x, xlWorkSheet.Cells(1, x).value.ToString)
    Next
    ComboBox2.DataSource = New BindingSource(Excols, Nothing)
    ComboBox2.ValueMember = "Key"
    ComboBox2.DisplayMember = "Value"
    AddHandler ComboBox2.SelectedIndexChanged, AddressOf ComboBox2_SelectedIndexChanged
    End With
    Else
    MsgBox("Déja Pleine!", CType(MessageBoxIcon.Error, MsgBoxStyle))
    End If
    End Sub
    please help me 

    Hi
    >> when i select again the same column a message box will be shown "you have already select it
    Each time you select a value in the comobox , you could compare
     each cell’s value with the value you just selected in the first row. If  it is matched, then show the message box" you have already select it "
    >>And when i go back to choose another sheet then another column will be open without getting any error
    I am not sure the sentence’s meaning clearly, What do you mean about another column will be open?  what's the error , Can you clarify this more
    clear?
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can I get the name of the column in Cursor

    hi,
    how can i derive the name of the columns in cursor
    e.g
    suppose I have a cursor
    cursor c is select * from emp;
    c1 c%rowtype.
    for c1 in c
    I want to display the name of the column how can I do. i don't
    remember the name, but i need it to be displayed tooo.
    thanx in advance
    Sreekant

    You can only do this by DESCing the tables in the cursor and
    then coding eg. v_no := c1.empno;
    APC

  • Alias name for the column name in Prompt

    Hi,
    I have a scenario where I am taking column names into prompt. I have used the following SQL in the SQL results under "Show" option of the Prompt.
    SELECT CASE WHEN 1=0 THEN AGE.AGE ELSE '"Orders"."By OrderDate"' END FROM " Real Time"
    UNION ALL
    SELECT CASE WHEN 1=0 THEN AGE.AGE ELSE '"Orders"."By ShipDate"' END FROM "Real Time"
    My problem here is I am getting the column names into the Prompt as "Orders"."By OrderDate" and "Orders"."By ShipDate", which is not acceptable and readable for mat for the user. Is there any way that I can assign an alias name for the column name such as OrderDate and ShipDate in the above SQL.
    Your quick respose is appreciated.
    Thanks,
    Rama

    hi,
    try an alternative one....in your administrator make new columns with alias to ones you want...so you wiil be able to show whatever you want.
    Otherwise,is it possible to show
    SELECT CASE WHEN 1=0 THEN AGE.AGE ELSE '"Orders"."By OrderDate"' as "xxxxxxxxxxxxx"END FROM " Real Time"
    UNION ALL
    SELECT CASE WHEN 1=0 THEN AGE.AGE ELSE '"Orders"."By ShipDate"' as "yyyyyyyyyyyyyyyy"END FROM "Real Time"
    Ending,you want the data from your columns?or just the name??
    hope i helped...
    http://greekoraclebi.blogspot.com/

Maybe you are looking for

  • New hard drive but bookmarks still there

    Is it even remotely possible that a "new hard drive" with Mavericks freshly installed could have my old bookmarks on it?? Are they stored with our Apple ID or something? Because I'm on my 3rd replacement drive within a couple of months from this Appl

  • Error when setting dynamically the target URL in receiver SOAP Adapter

    Hi, I'm setting dynamically (from the mapping) the target URL in the receiver SOAP adapter: String url = "http://mosxd30:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=DUM&receiverParty=&receiverService=&interface=SI_OA_CustomInvoiceDa

  • Patch Creating Problem

    Hi   My BSP Application was running fine, few days back. But the BASIS guys had uploaded few patch on the sever. Now the look and feel of the BSP pages have changed. Infact i am not able to view several fields in the Page. Can any body help me out in

  • Regarding Search Help

    Hi Experts, We are having one Customised Transaction code for Project management and when i select Sales Employee and enter  the pernr , it will display all the sales order under him, but when i am not searching through Pernr Instead am pressing F4 w

  • HT4718 OS Maverick on my MacBook air  and now my Mail will not open -  what do I do to correct this

    I have just today installed OS Maverick on my MacBook Air and now my Mail will not open All i get is an error message - 1712  -  what do I do to correct this please