Solved

oracle null record

Posted on 2000-05-08
8
227 Views
Last Modified: 2008-02-01
hi...
im working in asp on oracle database.
let's say im making select list box:

<select name="hour">
<option value="">choose hour</option>
<option value="0800">08:00</option>
<option value="0900">09:00</option>
</select>
<input type=submit...

in the next as page:
<%
hour=request.form("hour")
sql="insert into hours values('"&hours"',23,'user')"
%>
in this case the user CAN choose the first choice (<option value="">)-
which mean the database get "" as value.
how can i search for this record?
is this right?
sql="select * from hour where hour is NULL"
or maybe
sql="select * from hour where hour=""

thanx
eladr
p.s. : im on oracle db.


0
Comment
Question by:eladr
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 10

Expert Comment

by:makerp
ID: 2787662
it depend on how you insert the record.

first of all allow null fields in that col.

then either inset it as NULL (thas what i do) and serach for it as 'field Is Null'

or insert it as '' and serach for 'field = '''

both will work fine.

hope this helps

ohh

in your select box just put the value on the empty one to either value="NULL" or value = "". if you use value="NULL" rememebr not to wrap it in '' when inserting it as youll actuall insert the word NULL
0
 
LVL 2

Expert Comment

by:gaetansavoie
ID: 2788897
Yes this shoud work:

sql="select * from hour where hour is NULL"
0
 
LVL 11

Expert Comment

by:mouatts
ID: 2790584
For Oracle you should use

field IS NULL as it is optomises better than =''.

But I wouldn't use option value=NULL as someone is likely to come along and wrap it quotes (won't I makep :) )

0
 
LVL 1

Author Comment

by:eladr
ID: 2791372
so i understand that the query must be where
field is NULL .
but what should i put in the empty value option:
<option value=null...>
<option value=""l...>
??
elad
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Expert Comment

by:makerp
ID: 2791699
hi mouatts.

you would never do such a thing :)

i think that for your solution the '' would be easier to implement than the NULL. just set the option value to "" and then one simple insert will cope with "" and hours...

INSERT iNTO blah1 (hours) VALUES('"&Request("hours")&"')

a select will also be simplyfied. a select box could be used to the same effect....

0
 
LVL 11

Accepted Solution

by:
mouatts earned 15 total points
ID: 2791759
eladr

use either "" or no value at all in the option tag

which will resolve to '' in an update ie set x='"&request("selectname")&"'...

but use IS NULL in a selection.

Steve
0
 
LVL 1

Author Comment

by:eladr
ID: 2791768
it was hard to choose the best answer.
mautas was the most complete.
thanks you all
happy independence day for israel !
0
 
LVL 10

Expert Comment

by:makerp
ID: 2791779
it will be easier to use "" as then your select box will not have to have NULL in which means you wont have to make sure you dont quote it up..

any way if you have inserted "" the field Is Not NUll :) so select where IS NULL will fail unless you enetred NULL.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Classic ASP - cannot find folder on the server 5 31
EOF BOF error classic asp 8 42
Forcing form refresh - classic ASP 7 57
API works for 1 result, need to make it many 30 66
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now