Need to insert into NVARCHAR2 column in a database table

I need to insert into a table with column type NVARCHAR2(2000) in java.
Cant use normal setString on that column. How can I do this using PreparedStatement in Java?

The scenario is:
I have to read a CSV file which contains a column in Urdu language, and show it on the JTable first.
Then I have to import the JTable contents into a database table.
Database Table structure is:
CREATE TABLE IMPORT_TMP (
ctype          VARCHAR2(3),
urdu_name  NVARCHAR2(2000)
);My java code which inserts into the database table is:
                Vector dataVector = tableModel.getDataVector();
                rowVector = (Vector) dataVector.get(row);
              cType = "";
                if (rowVector.get(INDEX_BANK) != null) {
                    cType = rowVector.get(INDEX_CTYPE).toString();
                urduName = "";
                if (rowVector.get(INDEX_URDU_NAME) != null) {
                    urduName = rowVector.get(INDEX_URDU_NAME).toString();
                statementInsert.setString(1, cType);
                statementInsert.setString(2, urduName);I also applied Renderer on the table column, my renderer class is:
public class LangFontRenderer extends JLabel implements TableCellRenderer {
    private Font customFont;
    public LangFontRenderer(Font font) {
        super();
        customFont = font;
        System.out.println("font = " + font.getFontName());
        this.setFont(font);
    @Override
    public Component getTableCellRendererComponent(JTable table,
            Object value, boolean isSelected, boolean hasFocus, int row, int column) {
        if (value != null) {
            if (value instanceof String) {
                setText((String) value);
                return this;
        return this;
    @Override
    public Font getFont() {
        return customFont;
    // overriding other methods for performance reasons only
    @Override
    public void invalidate() {
    @Override
    public boolean isOpaque() {
        return true;
    @Override
    public void repaint() {
    @Override
    public void revalidate() {
    @Override
    public void validate() {
}I applied the renderer on the column as:
        TableColumn col = IATable.getColumnModel().getColumn(INDEX_URDU_NAME);
        LangFontRenderer langRenderer = new LangFontRenderer(new java.awt.Font("Urdu Naskh Asiatype", 0, 11));
        col.setCellRenderer(langRenderer);It does not give any error but when i query on the database table it does not show the column data in Urdu language.
Also it does not show the correct value on JTable column, some un-identified symbols.
Furthermore when I open the CSV file in notepad, it shows the correct language in that column, as I have installed the Urdu language and font on my system.

Similar Messages

  • Insert into NVARCHAR2 columns(ORA_01461, ORA-01026)

    Hi,
    Oracle8i Client 8.1.5 (OCI8)
    Oracle9i Client 9.0.1 (OCI9)
    Oracle8i/9i DB
    I want to insert strings into a table with two NVARCHAR2 columns with OCI.
    NLS_NCHAR_CHARACTERSET is UTF8 (DB). The provided String is encoded in Windows-1252.
    The supplied buffers in the OCIBindByPos have a size of 200bytes each.
    ->With OCI8 I'm getting the message:
    "ORA-01026 multiple buffers of size > 4000 in the bind list"
    If only one NVARCHAR2 column is involved (or if I use normal
    VARCHAR2 instead) it works fine.
    ->With OCI9 I get the message:
    "ORA-01461 can bind a LONG value only for insert into a LONG column"
    But only, if I set the OCI_ATTR_MAXDATA_SIZE attribute.
    If I do not set the OCI_ATTR_MAXDATA_SIZE attribute, it works, but if
    I supply a buffer bigger than 1333 bytes in the OCIBindByPos for the second
    NVARCHAR2 column, then ORA_01461 happens. The buffer for the first NVARCHAR2
    column can be set to a higher values
    ->The same behaviour occurs with NCHAR, NCLOB (->national character types)
    These are the main steps:
    OCIBindByPos((OCIStmt *) pStmtInsert, (OCIBind **) &pBind,
    (OCIError *) pError, (ub4) i, (dvoid *)pData,
    (sb4) bufferSize, //200bytes
    (ub2) dataTypeSQLT, //SQLT_STR
    (dvoid *) pIndicator, (ub2 *) 0, (ub2 *) 0, (ub4) 0,
              (ub4 *) 0, (ub4) OCI_DEFAULT);
    OCIAttrSet((dvoid *) pBind, OCI_HTYPE_BIND,
    &Frm, //SQLCS_NCHAR
         0, OCI_ATTR_CHARSET_FORM, (OCIError *) pError);
    OCIAttrSet((dvoid *) pBind, OCI_HTYPE_BIND,
    (dvoid *) &charSet, //WE8MSWIN1252
         0, OCI_ATTR_CHARSET_ID, (OCIError *) pError);
    OCIAttrSet((dvoid *) pBind, OCI_HTYPE_BIND,
    (dvoid *) &maxDataSize, //->size of the column in bytes
    0, OCI_ATTR_MAXDATA_SIZE, (OCIError *) pError);
    OCIStmtExecute((OCISvcCtx *) pServiceContext, (OCIStmt *) pStmtInsert,(OCIError *) pError,
    (ub4) 1, (ub4) 0, (OCISnapshot *) 0, (OCISnapshot *) 0,
    OCI_COMMIT_ON_SUCCESS);
    Any ideas?
    Thanks,
    Axel

    I found this link referring to a similar problem that was apparently fixed in version 10.2.0.4 of the server: ORA-01461: can bind a LONG value only for insert into a LONG column Should I try to upgrade the server and see if that fixes things?

  • I have a DVD format VTS and I need to insert into a powerpoint presentation can anyone tell me the steps because what I normally do to insert media into a presentation is not working

    I have a DVD which I need to insert into a presentation does anyone know how to do this.
    The video format is VTS and I have saved the DVD on my desk top but it wont let me insert into my presentation.

    Sounds like your issue is between gmail and charter. Thunderbird would have no part in this operation.

  • ORA- 01461 : Can Bind a long value only for insert into a column error

    I was trying to create a new job using dbms_job.isubmit
    begin
    sys.dbms_job.isubmit(job => 1111,
    what => '',
    next_date => to_date('21-10-2011 03:00:00', 'dd-mm-yyyy hh24:mi:ss'),
    interval => 'TRUNC(SYSDATE+1)+3/24');
    commit;
    end;
    However, I am getting the error 'ORA- 01461 : Can Bind a long value only for insert into a column error'.
    I tried a lot but cant get rid of.
    Any help gurus ?

    You have an error in the code:
    1. you don't provide a value for 'what' - you have to tell Oracle what it should execute when it submits the job.
    And remember - with ISUBMIT the next_date parameter has datatype VARCHAR2 - SUBMIT uses datatype DATE. So make sure you provide a VARCHAR2 value and do not rely on implicit conversion.
    >
    PROCEDURE DBMS_JOB.ISUBMIT
    (job IN BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN VARCHAR2
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);
    PROCEDURE DBMS_JOB.SUBMIT
    (job OUT BINARY_INTEGER
    ,what IN VARCHAR2
    ,next_date IN DATE DEFAULT SYSDATE
    ,interval IN VARCHAR2 DEFAULT 'null'
    ,no_parse IN BOOLEAN DEFAULT FALSE);

  • Split one column  value and insert into multiple columns

    hi
    am new to plsql .
    i want to split a characters from one column and insert into multiple columns
    i tried used substr function the symbol ',' vary his place dynamically ,so i can't apply substr function.
    for eg:  before split
    col1 :
    col2 :
    col3 :
    col4 :
    colu5: adsdf,fgrty,erfth,oiunth,okujt
    after split
    col1 :adsd
    col2 :fgrty
    col3 :erfth
    col4 :oiunth
    col5 : adsdf,fgrty,erfth,oiunth,okujt
    can anyone help me
    thanks
    Edited by: 800324 on Dec 23, 2010 8:28 AM
    Edited by: 800324 on Dec 23, 2010 8:36 AM

    How about:
    SQL> create table t
      2  (col1 varchar2(30)
      3  ,col2 varchar2(30)
      4  ,col3 varchar2(30)
      5  ,col4 varchar2(30)
      6  ,col5 varchar2(30)
      7  );
    Table created.
    SQL> insert into t (col5) values ('adsdf,fgrty,erfth,oiunth,okujt');
    1 row created.
    SQL> insert into t (col5) values ('x,y');
    1 row created.
    SQL> insert into t (col5) values ('a,b,c,d');
    1 row created.
    SQL> select * from t;
    COL1                           COL2                           COL3                           COL4                           COL5
                                                                                                                                adsdf,fgrty,erfth,oiunth,okujt
                                                                                                                                x,y
                                                                                                                                a,b,c,d
    3 rows selected.
    SQL>
    SQL> merge into t a
      2  using ( with t1 as ( select col5||',' col5
      3                       from   t
      4                     )
      5          select substr(col5, 1, instr(col5, ',', 1, 1)-1) col1
      6          ,      substr(col5, instr(col5, ',', 1, 1)+1, instr(col5, ',', 1, 2)- instr(col5, ',', 1, 1)-1) col2
      7          ,      substr(col5, instr(col5, ',', 1, 2)+1, instr(col5, ',', 1, 3)- instr(col5, ',', 1, 2)-1) col3
      8          ,      substr(col5, instr(col5, ',', 1, 3)+1, instr(col5, ',', 1, 4)- instr(col5, ',', 1, 3)-1) col4
      9          ,      rtrim(col5, ',') col5
    10          from   t1
    11        ) b
    12  on ( a.col5 = b.col5 )
    13  when matched then update set a.col1 = b.col1
    14                             , a.col2 = b.col2
    15                             , a.col3 = b.col3
    16                             , a.col4 = b.col4
    17  when not matched then insert (a.col1) values (null);
    3 rows merged.
    SQL> select * from t;
    COL1                           COL2                           COL3                           COL4                           COL5
    adsdf                          fgrty                          erfth                          oiunth                         adsdf,fgrty,erfth,oiunth,okujt
    x                              y                                                                                            x,y
    a                              b                              c                              d                              a,b,c,d
    3 rows selected.
    SQL> Assuming you're on 9i...

  • Inserting multiple selection from checkbox into one column of the database

    Hi,
    How to insert multiple selection values from checkbox into one column of the database.
    Anyone can u help me
    Thanx

    hi
    try to use request.getParameterValues("fieldname")

  • How to copy one column BLOB value into another column of another database.

    How to copy one column BLOB value into another column of another database.
    BLOB value contains word document.
    I thought of copy the BLOB value into a text file and then update the new column value by the same text in textfile. Will this work?
    Is there any other better way to do this?

    You're welcome
    BLOB fields contains binary data. I don't think you can do this
    Also if I view the BLOB as text. Can I copy it and insert into the new database.
    I think your options are as I said. Datapump or CTAS
    Best Regards

  • Need to add 2 new columns to the existing table control of C223 transaction

    Hi ABAP Gurus,
    I have to do a screen enhancement for transaction C223.
    Below is the requirement:
    need to add 2 new columns to the existing table control of C223 transaction.
    there is no customer exits, screen exit or user exit present for this transaction C223, i have found one enhancement spot for this transaction.
    i dont have any idea how to do this in standard transaction C223, the table control in C223 saves the data to MKAL table and the table control uses the structure MKAL_EXPAND in the screen program.
    i have created an append structure for  the 2 fields to the standard table MKAL.
    Can anyone please suggest me how this can be done in standard screen C223, will the enhancement spot can be used to do this....
    please sugest...
    Thanks & Regards

    Hi Santosh,
    Thanks for the reply. I have looked into this Enhancement Spot CPFX_SCREEN_SET , inside this there is only one method INPUT_DISABLED having below parameters
    IM_MKAL     Importing     Type     MKAL                                                                                Production Version
    EX_MSGID     Exporting     Type     SY-MSGID                                                                                Messages, Message
    EX_MSGTY     Exporting     Type     SY-MSGTY                                                                                Messages, Message
    EX_MSGNO     Exporting     Type     SY-MSGNO                                                                                Messages, Message
    EX_MSGV1     Exporting     Type     SY-MSGV1                                                                                Messages, Message
    EX_MSGV2     Exporting     Type     SY-MSGV2                                                                                Messages, Message
    EX_MSGV3     Exporting     Type     SY-MSGV3                                                                                Messages, Message
    EX_MSGV4     Exporting     Type     SY-MSGV4                                                                                Messages, Message
    EX_INPUT_DISABLE     Exporting     Type     CHAR1                                                                                Display Only if X Was Set
    the BADI definition present here is a SAP internal so we cant implement the BADI , but we can created a enhancement spot implementation for this. as per my understanding on this the enhancement spot is only for making the table control fields display / change .  i dont think this can be used to add two new coloumns to C223 table control.
    I am not sure thats why seeking your help/valuable sugestion on this.
    Please provide your sugestion on this , so that i can come to conclusion on this issue.
    Thanks & Regards
    Siddhartha Mishra

  • Update A Column In A Database Table.

    I am unable to update a column in a database table.
    For example; I have ten records in an EMP table without having any EMPNO. I want to UPDATE (insert) 10 different EMPNO in a table. How can I do it? All I know is that there are ten records in the table; this means that I cannot use a WHERE clause with different criteria for each row.
    Thanks.

    Try something like this
    SQL> select * from emp_1
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
    14 rows selected.
    SQL> insert into emp_1(empno, ename, job, mgr, hiredate, sal, comm, deptno)
      2  select null, ename, job, mgr, hiredate, sal, comm, deptno
      3    from emp_1
      4   where rownum <= 10
      5  /
    10 rows created.
    SQL> select * from emp_1
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
               SMITH      CLERK           7902 17-DEC-80        800                    20
               ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
               WARD       SALESMAN        7698 22-FEB-81       1250        500         30
               JONES      MANAGER         7839 02-APR-81       2975                    20
               MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
               BLAKE      MANAGER         7839 01-MAY-81       2850                    30
               CLARK      MANAGER         7839 09-JUN-81       2450                    10
               SCOTT      ANALYST         7566 19-APR-87       3000                    20
               KING       PRESIDENT            17-NOV-81       5000                    10
               TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
    24 rows selected.
    SQL> select max(empno) from emp_1
      2  /
    MAX(EMPNO)
          7934
    SQL> create sequence emp_seq start with 7935
      2  /
    Sequence created.
    SQL> update emp_1 set empno = emp_seq.nextval where empno is null
      2  /
    10 rows updated.
    SQL> select * from emp_1
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH      CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82       1300                    10
          7935 SMITH      CLERK           7902 17-DEC-80        800                    20
          7936 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
          7937 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7938 JONES      MANAGER         7839 02-APR-81       2975                    20
          7939 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7940 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7941 CLARK      MANAGER         7839 09-JUN-81       2450                    10
          7942 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7943 KING       PRESIDENT            17-NOV-81       5000                    10
          7944 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
    24 rows selected.

  • [Forum FAQ] How to configure a Data Driven Subscription which get multi-value parameters from one column of a database table?

    Introduction
    In SQL Server Reporting Services, we can define a mapping between the fields that are returned in the query to specific delivery options and to report parameters in a data-driven subscription.
    For a report with a parameter (such as YEAR) that allow multiple values, when creating a data-driven subscription, how can we pass a record like below to show correct data (data for year 2012, 2013 and 2014).
    EmailAddress                             Parameter                      
    Comment
    [email protected]              2012,2013,2014               NULL
    In this article, I will demonstrate how to configure a Data Driven Subscription which get multi-value parameters from one column of a database table
    Workaround
    Generally, if we pass the “Parameter” column to report directly in the step 5 when creating data-driven subscription.
    The value “2012,2013,2014” will be regarded as a single value, Reporting Services will use “2012,2013,2014” to filter data. However, there are no any records that YEAR filed equal to “2012,2013,2014”, and we will get an error when the subscription executed
    on the log. (C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\LogFiles)
    Microsoft.ReportingServices.Diagnostics.Utilities.InvalidReportParameterException: Default value or value provided for the report parameter 'Name' is not a valid value.
    This means that there is no such a value on parameter’s available value list, this is an invalid parameter value. If we change the parameter records like below.
    EmailAddress                        Parameter             Comment
    [email protected]         2012                     NULL
    [email protected]         2013                     NULL
    [email protected]         2014                     NULL
    In this case, Reporting Services will generate 3 reports for one data-driven subscription. Each report for only one year which cannot fit the requirement obviously.
    Currently, there is no a solution to solve this issue. The workaround for it is that create two report, one is used for view report for end users, another one is used for create data-driven subscription.
    On the report that used create data-driven subscription, uncheck “Allow multiple values” option for the parameter, do not specify and available values and default values for this parameter. Then change the Filter
    From
    Expression:[ParameterName]
    Operator   :In
    Value         :[@ParameterName]
    To
    Expression:[ParameterName]
    Operator   :In
    Value         :Split(Parameters!ParameterName.Value,",")
    In this case, we can specify a value like "2012,2013,2014" from database to the data-driven subscription.
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    For every Auftrag, there are multiple Position entries.
    Rest of the blocks don't seems to have any relation.
    So you can check this code to see how internal table lt_str is built whose first 3 fields have data contained in Auftrag, and next 3 fields have Position data. The structure is flat, assuming that every Position record is related to preceding Auftrag.
    Try out this snippet.
    DATA lt_data TYPE TABLE OF string.
    DATA lv_data TYPE string.
    CALL METHOD cl_gui_frontend_services=>gui_upload
      EXPORTING
        filename = 'C:\temp\test.txt'
      CHANGING
        data_tab = lt_data
      EXCEPTIONS
        OTHERS   = 19.
    CHECK sy-subrc EQ 0.
    TYPES:
    BEGIN OF ty_str,
      a1 TYPE string,
      a2 TYPE string,
      a3 TYPE string,
      p1 TYPE string,
      p2 TYPE string,
      p3 TYPE string,
    END OF ty_str.
    DATA: lt_str TYPE TABLE OF ty_str,
          ls_str TYPE ty_str,
          lv_block TYPE string,
          lv_flag TYPE boolean.
    LOOP AT lt_data INTO lv_data.
      CASE lv_data.
        WHEN '[Version]' OR '[StdSatz]' OR '[Arbeitstag]' OR '[Pecunia]'
             OR '[Mita]' OR '[Kunde]' OR '[Auftrag]' OR '[Position]'.
          lv_block = lv_data.
          lv_flag = abap_false.
        WHEN OTHERS.
          lv_flag = abap_true.
      ENDCASE.
      CHECK lv_flag EQ abap_true.
      CASE lv_block.
        WHEN '[Auftrag]'.
          SPLIT lv_data AT ';' INTO ls_str-a1 ls_str-a2 ls_str-a3.
        WHEN '[Position]'.
          SPLIT lv_data AT ';' INTO ls_str-p1 ls_str-p2 ls_str-p3.
          APPEND ls_str TO lt_str.
      ENDCASE.
    ENDLOOP.

  • Can't insert data into NVARCHAR2 column

    I have a Oracle 8.1.7 database with character set WE8ISO8859P15 and the same for the national character set. I created a table with one column of the VARCHAR2 type and everything worked fine. But when I change the column type to NVARCHAR2 I get various errors: ORA-12704 (when using JDBC), ORA-00911 (when trying to insert euro symbol using Oracle DBA Studio), ORA-00984 (when trying to insert 'abc' using Oracle DBA Studio). Can anyone tell me what is causing these errors??

    i used oracle dba studio to create the table. it's just one column named CONTENT of type NVARCHAR2 (256).
    this is what i did with SQL plus:
    SQL> insert into test2 values ('test');
    insert into test2 values ('test')
    ERROR at line 1:
    ORA-12704: character set mismatch
    SQL> insert into test2 values (to_nchar('test'));
    insert into test2 values (to_nchar('test'))
    ERROR at line 1:
    ORA-00904: invalid column name
    SQL> insert into test2 (content) values ('test');
    insert into test2 (content) values ('test')
    ERROR at line 1:
    ORA-12704: character set mismatch
    SQL> insert into test2 (content) values (to_nchar('test'));
    insert into test2 (content) values (to_nchar('test'))
    ERROR at line 1:
    ORA-00904: invalid column name

  • Inserting data into a column from 2 different tables

    Hi,
    I need to insert data into a table using 2 other tables. The tables that contain data have identical column names.
    Is using a UNION statement the only option?
    Also, if I need to insert data into columns from only one of the either tables, how do i do it?
    Thanks.

    For future reference, "doesn't seem to work" is a rather generic description... Posting the particular error message will be quite helpful, though I'm reasonably confident that I know the particular problem here.
    First, if only for sanity, you probably want to explicitly list the columns of the destination table in your INSERT statement.
    Second, it doesn't make sense to have DISTINCT clauses in queries that are UNION-ed together. A UNION has to do a sort to remove duplicates already.
    Third, the two queries you are UNIONing together have to return the same number of columns, with the same names, in the same order.
    You probably want something like
    INSERT INTO new_table( col1, col2, col3, col4, col5 )
      SELECT 'ABC'  col1,
             a.colA col2,
             a.colB col3,
             a.colC col4
             a.colD col5
        FROM table1 a
      UNION
      SELECT 'ABC'  col1,
             b.colA col2,
             b.colB col3,
             b.colC col4
             NULL   col5
        FROM table2 bJustin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Insert into blob column from form6i

    Dear all,
    I have a question....
    I need to develop an application with form6i which gets the filename and path from user and inserts the content of the file in a table with blob column...
    the files may be in any format...How can I do it in oracle form 6i..our database is 10g...
    If anybody has a sample please send me :[email protected]
    ThanX
    Farnaz

    If you want to insert a string and next convert to BLOB, you use the next SQL
    PreparedStatement ps = connectionObject.prepareStatement("INSERT INTO TEST_BLOB(NO,STR) VALUES(?,TO_BLOB(?))");and next
    ps.setInt(1, "1");
    ps.setString(2,"sample string here");

  • Need help in writing NVARCHAR2 column to an excel sheet

    Hi All,
    I have a NVARCHAR2 column in my table. I want to store the data present in the column into an excel file. When i write the data to an excel file the data is getting converted to some other form. It's not in human readable form.
    Language is not fixed for the column.
    I need help in storing the NVARCHAR2 data into an excel file without any implicit conversion done by the oracle.
    Please help.
    Thanks,
    Girish G
    Edited by: Girish G on Jul 14, 2011 2:02 AM

    Export data to BLOB (csv)

  • JDBC program is inserting ¿ in NVARCHAR2 column.

    I have a 10.2.0.1 database on a windows XP machine.
    The value of NLS_CHARACTERSET is WE8MSWIN1252 and the value of NLS_NCHAR_CHARACTERSET     is AL16UTF16.
    I have a table with a NVARCHAR2 column. I am using JDBC thin driver to connect to the database. When I am to inserting a japanese character to this column, the value that is getting inserted is ¿ (inverted question mark) instead of the actual Japanese character. Following is the code snippet of my Java program
    Class.forName("oracle.jdbc.OracleDriver");
    props.put("user", "bcan");
    props.put("password","bcan2226");
    url = "jdbc:oracle:thin:@myserver:1521:eng";
    Connection conn = DriverManager.getConnection(url, props);
    String value = "abcdefghi\u7c73"; //\u7c73 is the japanese character
    String sql = "insert into I18N VALUES ('" + value + "')";
    Statement stmt = conn.createStatement();
    stmt.executeUpdate(sql);
    Can you please let me know why is ¿ getting inserted instead of the japanese character I am trying to insert?
    BTW I noticed that if I use PreparedStatement like the following then the proper character gets inserted.
    Class.forName("oracle.jdbc.OracleDriver");
    props.put("user", "bcan");
    props.put("password","bcan2226");
    props.put("oracle.jdbc.defaultNChar","true");
    url = "jdbc:oracle:thin:@myserver:1521:eng";
    Connection conn = DriverManager.getConnection(url, props);
    String value ="abcdefghi\u7c73";
    String sql = "insert into I18N VALUES (?)";
    PreparedStatement stmt = conn.prepareStatement(sql);
    stmt.setString(1,value);
    stmt.executeUpdate();
    Thanks
    Sudipta

    I do not think that you are hitting a "bug". Instead what you are seeing is expected behaviour since sql and literals (e.g. your string) are processed in the database character set unless you specify otherwise (e.g. explicit bind).
    Go through docs per links in my previous post.
    For the bug referenced, it seemed to be fixed according to jdbc driver Readme of 10.2.0.4.

Maybe you are looking for

  • HT2731 do not know the answers to my security questions

    do not know the answers to my security questions, do not remember ever setting them up

  • Email attachments in macbook

    When I try and attach a document, picture etc. in an Email on my macbook, I click the paper clip attachment and it opens the document in my Email rather than attaching it. Can anyone tell me what I am doing wrong? Thank you

  • When I open a new tab, there is always greyed out thumbs of previous webpages on it. Ver 13.0

    I just updated FF to v.13.0 and now whenever I open a new tab, I see greyed out thumbs of previous pages I was on instead of a blank screen. Also, when I browse some sites and click on a link, sometimes I will get a Foxit Reader error message dialog

  • Connecting to java

    Hello my heros. I have enough knowllege of java programming skills that I can use to write real programs and also enough Oracle9i knowllege to talk to the server. My problem is how to connect from java application to an Oracle9i server. I found examp

  • Format new hard drive

    Hello, I have some issues with the new hard drive I am currently installing. My old hard drive crashed on my MacBook Pro (Mid 12) and I bought a new hard drive to use. The problem is that I can not erase and format the hard drive to work with the ope