default values not defaulting [message #372066] |
Mon, 08 January 2001 16:49 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
Mike Oakes
Messages: 25 Registered: December 2000
|
Junior Member |
|
|
Hello,
I have a default set up in my database for char and varchar columns. The default is set to ''(quote,quote). I am finding that when I create a record (without referencing the column so that the default is used) it is not putting in the ''(quote,quote) default. (although it is putting in a value that has a length unknown)
The reason I say this is that when I perform a select statement where column1=''. The record is not found. I think that ORACLE is somehow converting this data possibly because a '' is not valid. I am not sure. Has anyone seen this before. My problem is that most of my sql queries are using where column='' and it is not picking up the records.
thanks alot for your help,
Mike Oakes
|
|
|
Re: default values not defaulting [message #372082 is a reply to message #372066] |
Tue, 09 January 2001 08:46 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
me
Messages: 66 Registered: August 2000
|
Member |
|
|
Setting a value to ''(quote,quote) will set the value to null. To query a null value field: select statement where column1 is null.
If you actually want the char string ''(quote,quote) to be inserted as a value, set the default value to '''''' (quote,quote,quote,quote,quote,quote). You have to use two single quotes to tell oracle that you want one of the quotes is part of the char string.
So you need the the opening and closing quote of a char string and two quotes for each quote of the char string.
|
|
|