Thursday, 15 May 2014

sql - Insert /Update Multiple spaces in a column in oracle -


I have a column of type varchar2 10 and I will update that column with 7 I want to do it only on empty spaces, but when I try to select or update the value, I get only one place.

How can I update the column because the 7 spaces are just an updateable value?

I tried the following query:

  Make the table temporary (name varchar (10)); Enter in temporary values ​​(''); Update temporary set name = ''; Committed; Choose * from temp;   

I get columns with only 1 location;

I am using Oracle SQL * Plus.

Do not worry, there are 7 spaces, this is a SQL * plus that hides the key position on the display. You can prove it with some additional symbols around the name column:

  select '> gt; Name || '& Lt;' From Temp; & Gt; & Lt;   

Edit: The offender is WORD_WRAPPED -feature. To prevent SQL * plus from eating empty space, format from WORD_WRAPPED to wrappied or TRUNCATED :

  Update Temporary Set Name = 'X'; SQL & gt; Column name format a10 word sql & gt; Select the name from Temp; NAME ---------- x SQL & gt; Column name format a10 trunc SQL & gt; Select the name from Temp; NAME ---------- x    

No comments:

Post a Comment