Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

oracle null record

Posted on 2000-05-08
8
Medium Priority
?
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
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 60 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

636 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