Insert ' character in a varchar2 column

How can i insert ' character in a column. For example I want to insert
HARINDER ' KANDA
in a name column in one of tables. I get the message "Quoted String not properly terminated"

Hello Dear,
Just use single quotes two times instead of one like:
HARINDER''KANDA
Remember that it's two single quotes one after another not a double quote.

Similar Messages

  • Strange Problem When Inserting " £ " character in a varchar2 column

    Hello
    This is a very strange issue i am facing when i use SQL+ on different clients.
    Client 1 ( SQL+) 9.2.0.4.0
    conn scott@ora9i
    SQL> insert into dummy values( '£');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from dummy;
    A
    ¿
    Client 2 ( SQL+) 9.2.0.4.0
    conn scott@ora9i
    SQL> insert into dummy values( '£');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from dummy;
    A
    £
    Has any one faced this issue before , I am sure it is something to do with Client Language / Character .
    Any help would be much appreciated.
    Thanks
    Harshad

    Cheers Mate , You are a Star ,
    Thanks Once again .
    Regards
    Harshad

  • Replace any occurence of a character in a varchar2 column

    What would be the best way to replace any occurence of a character in a column (varchar2) of a table?
    Lets say we want to replace any occurence of the character ~ by the character & in the column c1 of the table t.
    Is it possible in pure SQL?
    I did it in PL/SQL in a while loop but I am pretty sure there is a way to do that in a single SQL statement. Am I right on wrong?
    Thanks
    Best regards,
    Carl

    The Ampersand has a special meaning in SQL to mark a variable.
    That's why you need to set 'scan off' or 'define off' or
    For more information see here
    http://download-west.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm#1012408
    set scan off
    update t
    set c1=replace(c1, '~', '&');

  • Storing a Non Printable -from keyboard- Character in Varchar2 Column

    Hi,
    I want to store a non-printable character in a varchar2 column. This character should be non-printable -from keyboard- for all character sets -or very difficult to print from keyboard-. It doesn't matter, whether it can be displayed on screen or not. It does matter INSTR function returns the character position of that character. It should be able to import export data without any problem for any NLS specific operating environment. For example, I plan to use chr(1) do you think it's appropriate? I appreciate your helps.
    Best Regards,
    Salim

    What is the business requirement you're trying to satisfy?
    If your database character set is based on ASCII, CHR(1) (the Start of Header) character is likely to be transferred between systems without character set conversion. Non-ASCII character sets (i.e. Big5 for Chinese data) don't necessarily share the same control characters, though, and generally won't have the same binary representation of an ASCII control character (so CHR(1) in a non-ASCII based database wouldn't necessarily return the same character that CHR(1) would in an ASCII based database).
    Justin

  • ORA-01401: inserted value too large for column from 9i to 8i

    Hi All,
    Am trying to get the data from 9.2.0.6.0 to 8.1.7.0.0.
    The character sets in both of them are as follows
    9i
    NLS_NCHAR_CHARACTERSET : AL16UTF16
    NLS_CHARACTERSET : AL32UTF8
    8i
    NLS_NCHAR_CHARACTERSET : UTF8
    NLS_CHARACTERSET : UTF8
    And the structure of the Table in 9i which am trying to pull is as follows.
    SQL> desc xyz
    Name Null? Type
    PANEL_SITE_ID NOT NULL NUMBER(15)
    PANELIST_ID NUMBER
    CHECKSUM VARCHAR2(150)
    CONTACT_PHONE VARCHAR2(100)
    HH_STATUS NUMBER
    HH_STATUS_DT DATE
    HH_RECRUITMENT_PHONE VARCHAR2(100)
    HH_RECRUITMENT_DT DATE
    FIRST_NET_USAGE_DT DATE
    INSTALL_DT DATE
    FNAME VARCHAR2(4000)
    LNAME VARCHAR2(4000)
    EMAIL_ADDRESS VARCHAR2(200)
    EMAIL_VALID NUMBER
    PASSWORD VARCHAR2(4000)
    And by connecting to one of the 8i schema am running the following script
    CREATE TABLE GPMI.GPM_HOUSEHOLDBASE_FRMP AS
    SELECT PANEL_SITE_ID,
    PANELIST_ID,
    LTRIM(RTRIM(CHECKSUM)) CHECKSUM,
    LTRIM(RTRIM(CONTACT_PHONE)) CONTACT_PHONE,
    HH_STATUS, HH_STATUS_DT,
    LTRIM(RTRIM(HH_RECRUITMENT_PHONE)) HH_RECRUITMENT_PHONE,
    HH_RECRUITMENT_DT,
    FIRST_NET_USAGE_DT,
    INSTALL_DT, LTRIM(RTRIM(FNAME)) FNAME,
    LTRIM(RTRIM(LNAME)) LNAME,
    LTRIM(RTRIM(EMAIL_ADDRESS)) EMAIL_ADDRESS,
    EMAIL_VALID,
    PASSWORD
    FROM [email protected];
    Am gettinh the following error.
    Can anyone of you fix this one.
    PASSWORD
    ERROR at line 14:
    ORA-01401: inserted value too large for column
    Thanks in Advance
    Sudarshan

    Additionally I found this matrix, which explains your problem:
    UTF8 (1 to 3 bytes) AL32UTF8 (1 to 4 bytes)
    MIN MAX MIN MAX
    CHAR 2000 666 2000 500
    VARCHAR2 4000 1333 4000 1000 */
    For column PASSWORD the maximum length is used (4000). UTF8 uses maximal 3 bytes for a character, while AL32UTF8 may use up to 4 characters. So a column defined in AL32UTF8 may contain characters, which do not fit in a corresponding UTF8 character.

  • EXEC SQL Error: ORA-01401: Inserted value too large for column

    Getting this SQL Error: ORA-01401: Inserted value too large for column..on an EXEC SQL Insert statement when writing to an
    external Oracle DB from SAP.
    On further analysis..it appears that this happens to the fields..when the string length matches the field length.
    Example:  Plant field is defined as char(4) on the SAP side and it is a Varchar2(4) on the Oracle side.
    When a value like '1015' is passed thru a variable in the insert statement then this ORA-01401 error pops up.
    No error:
       - if the value '1015' is passed directly in the insert statement to the external table  (or)
       - when a value with 3 chars or less(like the first three chars..101) is passed thru a variable  defined as 'Plant(4) type c'.
       - when using EXEC sql within SAP
       - when reading from the external db table
    This was working ok until the  Oracle Patch P9147110 was installed recently.
    Any suggestions !

    Hello Dvas,
    what's the characterset of your external database?
    What's the column definition in your external database (byte or character based)?
    If you use a characeterset like UTF8 it is possible, that one character needs more than one byte and then you will run into such kind of issues if the definition is too small.
    Regards
    Stefan

  • Oracle Best practices for changing  Byte to Char on Varchar2 columns

    Dear Team,
    Application Team wanted to change Byte to Char on Varchar2 columns to accommodate Multi byte character  on couple of production tables.
    Wanted to know is it safe to have mixture of BYTE and CHAR semantics in the same table i have read on the couple of documents that It's good practice to avoid using a mixture of BYTE and CHAR semantics columns in the same table.
    What happens if we have mixture of BYTE and CHAR semantics columns in the same table?
    Do we need to gather stats & rebuild indexes on the table after these column changes .
    Thanks in Advance !!!
    SK

    Application Team wanted to change Byte to Char on Varchar2 columns to accommodate Multi byte character  on couple of production tables.
    Wanted to know is it safe to have mixture of BYTE and CHAR semantics in the same table i have read on the couple of documents that It's good practice to avoid using a mixture of BYTE and CHAR semantics columns in the same table.
    No change is needed to 'accommodate Multibyte characters'. That support has NOTHING to do with whether a column is specified using BYTE or CHAR.
    In 11g the limit for a VARCHAR2 column is 4000 bytes, period. If you specify CHAR and try to insert 1001 characters that each take 4 bytes you will get an exception since that would require 4004 bytes and the limit is 4000 bytes.
    In practice the use of CHAR is mostly a convenience to the developer when defining columns for multibyte characters. For example for a NAME column you might want to make sure Oracle will allocate room for 50 characters REGARDLESS of the actual length in bytes.
    If you provide a name of 50 one byte characters then only 50 bytes will be used. Provide a name of 50 four byte characters and 200 bytes will be used.
    So if  that NAME column was defined using BYTE how would you know what length to use for the column? Fifty BYTES will seldom be long enough and 200 bytes SEEMS large since the business user wants a limit of FIFTY characters.
    That is why such columns would typically use CHAR; so that the length (fifty) defined for the column matches the logical length of the number of characters.
    What happens if we have mixture of BYTE and CHAR semantics columns in the same table?
    Nothing happens - Oracle could care less.
    Do we need to gather stats & rebuild indexes on the table after these column changes .
    No - not if you by 'need' you mean simply because you made ONLY that change.
    But that begs the question: if the table already exists, has data and has been in use without their being any problems then why bother changing things now?
    In other words: if it ain't broke why try to fix it?
    So back to your question of 'best practices'
    Best practices is to set the length semantics at the database level when the database is first created and to then use that same setting (BYTE or CHAR) when you create new objects or make DDL changes.
    Best practices is also to not fix things that aren't broken.
    See the 'Length Semantics' section of the globalization support guide for more best practices
    http://docs.oracle.com/cd/E11882_01/server.112/e10729/ch2charset.htm#i1006683

  • Inserted value too large for column error while scheduling a job

    Hi Everyone,
    I am trying to schedule a PL SQL script as a job in my Oracle 10g installed and running on Windows XP.
    While trying to Submit the job I get the error as "Inserted value too large for column:" followed by my entire code. The code is correct - complies and runs in Oracle ApEx's SQL Workshop.
    The size of my code is 4136 character, 4348 bytes and 107 lines long. It is a code that sends an e-mail and has a +utl_smtp.write_data([Lots of HTML])+
    There is no insert statement in the code whatsoever, the code only queries the database for data...
    Any idea as to why I might be getting this error??
    Thanks in advance
    Sid

    The size of my code is 4136 character, 4348 bytes and 107 lines long. It is a code that sends an e-mail and has a utl_smtp.write_data(Lots of HTML)SQL variable has maximum size of 4000

  • Inserting Image into a BLOB column in Oracle9i

    Hi,
    I am unable to insert image into a BLOB column. I am using Forms 6i REL 2 and Oracle 9i. But I could do it on Oracle 8i with same Forms version.
    Same thing is true for CLOB in 9i.
    Would you please try with this code?
    TABLE
    Create table x
    (Id number,
    Name CLOB,
    Pict BLOB);
    WHEN-BUTTON-PRESSED trigge
    declare
         x varchar2(265);
    begin
         x := get_file_name;
         read_image_file (x, 'GIF', 'picture.pict');
    end;
    Take care,
    Tarek

    Forms 9i and Oracle 9i work fine together for this case.

  • Inserted value too large for column

    Hi,
    I have a table (desc below), with only one trigger wich fill the operatcreat, operatmodif, datecreat and datemodif column at insert and update for each row. When I try to insert, I got the following messages :
    INSERT INTO tarifclient_element(tarifclient_code,article_code,prix) VALUES('12','087108',3.94);
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-01401: inserted value too large for column
    SQL> desc tarifclient_element
    Name Null? Type
    TARIFCLIENT_CODE NOT NULL CHAR(10)
    ARTICLE_CODE NOT NULL CHAR(20)
    PRIX NUMBER
    OPERATCREAT NOT NULL VARCHAR2(30)
    OPERATMODIF VARCHAR2(30)
    DATECREAT NOT NULL DATE
    DATEMODIF DATE
    NB : tarifclient_code is an ENABLED fk, article_code is a DISABLED fk. All values exists in both referenced tables.
    Any idea ?

    My trigger is not the problem, I tried to delete it and fill the columns manually and got the same error.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by allanplumb ():
    The SQL you have shown us looks OK
    (to me, au moins). However, perhaps the
    error is in the trigger which fills in
    the two operativ fields. It would execute
    at the same time as your insert, near
    enough.
    -- Allan Plumb<HR></BLOCKQUOTE>
    null

  • Storing more than 2000 characters in a varchar2 column in Oracle 11g?

    We have a table in Oracle 11g with a varchar2 column. We use a proprietary programming language where this column is defined as string. Maximum we can store 2000 characters (4000 bytes) in this column. Now the requirement is such that the column needs to store more than 2000 characters. The DBAs don't like BLOB, CLOB or LONG datatypes for maintenance reasons.
    There are 2 solutions I can think of -
    1. Remove this column from the original table and have a separate table for this column and then store each character in a row, in order to get more than 2000 characters. This table will be joined with the original table for queries.
    2. If maximum I need is 8000 characters, can I just add 3 more columns so that I will have 4 columns with 2000 char each to get 8000 chars. So when the first column is full, values would be spilled over to the next column and so on.
    Which one is a better and easier approach? Please suggest.

    Visu - Some people also do not like to use LOBs because of difficulty in reclaiming space and ever increasing LOB segments. Some of these problems were caused by Oracle bugs (eg, Bug 2944866 Free space in LOB table / tablespace not reused with ASSM, Bug 3019979 Space may not be reused efficiently in a LOB segment) - albeit in 9.2. I've seen a few bug reports for similar things in 10.2 (don't have the references). Still, if there is a workaround/patch is this reason enough to steer the application development into a new direction?

  • 'ORA-01401 inserted value too large for column' - 9i

    I am migrating a java application from 8i to 9i. The application is writing data to a oracle 8i database without any problem.
    When the underlying database source is switched to oracle 9i database(same databaseschema as 8i) by pointing to 9i instance , the application is
    encountering the error: 'ORA-01401 inserted value too large for column' when trying to insert a particular field. The fileld is declared as varchar2(400) in the both the database.
    The debug output from application also shows that the column data being inserted as 10 characters.The insert statement from SQLPLUS works fine. So it's looks like an issue with the JDBC driver for the 9i server. I am wondering if anyone has observed such strange behavior.
    Thanks
    Vijay

    Vijay,
    Are you using OCI driver ? There is a known issue with OCI driver when using setFixedCHAR before an INSERT statement. This problem only happens with a string of length zero. There is no known issue with THIN Driver. This is fixed in Oracle9i Release 2.
    regards
    Debu Panda
    Oracle

  • Inserted value too large for column Error

    I have this table:
    CREATE TABLE SMt_Session
         SessionID int NOT NULL ,
         SessionUID char (36) NOT NULL ,
         UserID int NOT NULL ,
         IPAddress varchar2 (15) NOT NULL ,
         Created timestamp NOT NULL ,
         Accessed timestamp NOT NULL ,
         SessionInfo nclob NULL
    and this insert from a sp (sp name is SMsp_SessionCreate):
         Now := (SYSDATE);
         SessionUID := SYS_GUID();
         /*create the session in the session table*/
         INSERT INTO SMt_Session
                   ( SessionUID ,
                   UserID ,
                   IPAddress ,
                   Created ,
                   Accessed )
         VALUES           ( SMsp_SessionCreate.SessionUID ,
                   SMsp_SessionCreate.UserID ,
                   SMsp_SessionCreate.IPAddress ,
                   SMsp_SessionCreate.Now ,
                   SMsp_SessionCreate.Now );
    It looks like the param SessionUID is the one with trouble, but the length of sys_guid() is 32, and my column has 36.
    IPAddress is passed to the sp with value '192.168.11.11', so it should fit.
    UserID is 1.
    I am confused, what is the column with problem ?

    CREATE OR REPLACE PROCEDURE SMsp_SessionCreate
         PartitionID IN      INT ,
         UserID IN      INT ,
         IPAddress IN      VARCHAR2 ,
         SessionID IN OUT      INT,
         SessionUID IN OUT      CHAR,
         UserName IN OUT      VARCHAR2,
         UserFirst IN OUT      VARCHAR2,
         UserLast IN OUT      VARCHAR2,
         SupplierID IN OUT      INT,
         PartitionName IN OUT      VARCHAR2,
         Expiration IN      INT ,
         RCT1 OUT      GLOBALPKG.RCT1
    AS
         Now DATE;
         SCOPE_IDENTITY_VARIABLE INT;
    BEGIN      
         Now := SYSDATE;
         -- the new Session UID      
         SessionUID := SYS_GUID();
         /*Cleanup any old sessions for this user*/
         INSERT INTO SMt_Session_History
                   ( UserID ,
                   IPAddress ,
                   Created ,
                   LastAccessed ,
                   LoggedOut )
         SELECT
                   UserID,
                   IPAddress,
                   Created,
                   Accessed,
                   TO_DATE(Accessed + (1/24/60 * SMsp_SessionCreate.Expiration))
         FROM SMt_Session
         WHERE     UserID = SMsp_SessionCreate.UserID;
         --delete old     
         DELETE FROM SMt_Session
         WHERE UserID = SMsp_SessionCreate.UserID;
         /*create the session in the session table*/
         INSERT INTO SMt_Session
                   ( SessionUID ,
                   UserID ,
                   IPAddress ,
                   Created ,
                   Accessed )
         VALUES           ( SMsp_SessionCreate.SessionUID ,
                   SMsp_SessionCreate.UserID ,
                   SMsp_SessionCreate.IPAddress ,
                   SMsp_SessionCreate.Now ,
                   SMsp_SessionCreate.Now );
         SELECT SMt_Session_SessionID_SEQ.CURRVAL INTO SMsp_SessionCreate.SessionID FROM dual;
         --SELECT SMt_Session_SessionID_SEQ.CURRVAL INTO SCOPE_IDENTITY_VARIABLE FROM DUAL;
         --get VALUES to return
         SELECT u.AccountName INTO SMsp_SessionCreate.UserName FROM SMt_Users u WHERE u.UserID = SMsp_SessionCreate.UserID;
         SELECT u.SupplierID INTO SMsp_SessionCreate.SupplierID FROM SMt_Users u WHERE u.UserID = SMsp_SessionCreate.UserID;
         SELECT u.FirstName INTO SMsp_SessionCreate.UserFirst FROM SMt_Users u WHERE u.UserID = SMsp_SessionCreate.UserID;
         SELECT u.LastName INTO SMsp_SessionCreate.UserLast FROM SMt_Users u WHERE u.UserID = SMsp_SessionCreate.UserID;
         BEGIN
              FOR REC IN ( SELECT
                   u.AccountName,
                   u.SupplierID,
                   u.FirstName,
                   u.LastName FROM SMt_Users u
         WHERE     UserID = SMsp_SessionCreate.UserID
              LOOP
                   SMsp_SessionCreate.UserName := REC.AccountName;
                   SMsp_SessionCreate.SupplierID := REC.SupplierID;
                   SMsp_SessionCreate.UserFirst := REC.FirstName;
                   SMsp_SessionCreate.UserLast := REC.LastName;
              END LOOP;
         END;
         BEGIN
              FOR REC IN ( SELECT PartitionName FROM SMt_Partitions
         WHERE     PartitionID = SMsp_SessionCreate.PartitionID
              LOOP
                   SMsp_SessionCreate.PartitionName := REC.PartitionName;
              END LOOP;
         END;
         /*retrieve all user roles*/
         OPEN RCT1 FOR
         SELECT RoleID     FROM SMt_UserRoles
         WHERE     UserID = SMsp_SessionCreate.UserID;
    END;
    this is the exact code of the sp. The table definition is this:
    CREATE TABLE SMt_Session
    SessionID int NOT NULL ,
    SessionUID char (36) NOT NULL ,
    UserID int NOT NULL ,
    IPAddress varchar2 (15) NOT NULL ,
    Created timestamp NOT NULL ,
    Accessed timestamp NOT NULL ,
    SessionInfo nclob NULL
    The sp gets executed with this params:
    PARTITIONID := -2;
    USERID := 1;
    IPADDRESS := '192.168.11.11';
    SESSIONID := -1;
    SESSIONUID := NULL;
    USERNAME := '';
    USERFIRST := '';
    USERLAST := '';
    SUPPLIERID := -1;
    PARTITIONNAME := '';
    EXPIRATION := 300;
    if I ran the code inside the procedure in sql+ (not the procedure), it works. when i call the sp i get the error
    inserted value too large for column
    at line 48

  • ORA-1401: inserted value too large for column

    Some versions (of Oracle 9i) insert a truncated string, newer versions (9.2.0.6.5) issue an error message and don’t insert anything.
    ORA-1401: inserted value too large for column
    We are aware of a 2000-character limit on literal strings (might be a byte limit instead of character) but you could always use concatenation to build up a longer string 2000 at a time. But this is rejected if the field is nvarchar2 and wider than 1000 (characters).
    Using a function, you can insert 2000 characters. For example, lpad(‘X’, 2000, ‘X’) will go in. But this will not:
    ‘XXXXXXXXXXXXXXXXXXXXXXXXXX’
    ||’XXXXXXXXXXXXXXXXXXXXXXXXX’
    . . . to >1000 characters.
    If anyone knows anything about this, we would appreciate hearing from you.

    we had this problem.
    We talked to some oracle person who said some portlets on a page had trouble exporting.
    Sure enough after we deleted all the portlets (one at a time to determine which one was giving us the problem. Turned out none of ours worked) the page exported and imported just fine.
    Hopefully this is being worked on...

  • How to insert data into the BLOB column

    Hi All,
    Can anyone help me to insert data into the BLOB data type column?
    The table structure is
    CREATE TABLE XXATFL_DM_FORCAST_STG
    TASK_ID NUMBER,
    USER_ID NUMBER,
    CREATED_BY NUMBER(15),
    CREATION_DATE DATE,
    LAST_UPDATED_BY NUMBER(15),
    LAST_UPDATE_DATE DATE,
    LAST_UPDATE_LOGIN NUMBER(15),
    RECORD_STATUS VARCHAR2(1 BYTE),
    ERROR_MESSAGE VARCHAR2(4000 BYTE),
    DATA_FILE BLOB
    I want to insert data in the DATA_FILE column. and this insert statement will in inside a procedure.
    Please help me as soon as possible as this is very urgent for me
    Thanks & Regards,
    Chandan

    i tried like this
    sql> insert into tbl values(1, utl_raw.cast_to_raw('D:\pictures\pic2.bmp'));
    1 record created.
    sql>select * from tbl;
    sp2-0678:Column or attribute type can not be displayed by SQL*PLUS
    sql>
    is this saving only path or bmp file on that path?
    if it is saving bmp file, in which format and how can we retrive it?
    Edited by: user8967883 on Mar 31, 2010 12:57 PM

Maybe you are looking for