Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: NULL value

Re: NULL value

From: Vince <vinnyop_at_yahoo.com>
Date: 28 Mar 2007 10:24:33 -0700
Message-ID: <1175102668.682041.29300@y80g2000hsf.googlegroups.com>


On Mar 28, 7:23 am, nicolas.kaczmar..._at_gmail.com wrote:
> Hello,
>
> I work on Oracle 10.1
> I would like to delete line in a table where some fields can be "NULL"
>
> EX :
>
> DELETE T_NOTIFICATION
> WHERE DOMAIN_SEQ=p_domain_seq
> AND DATASET_SEQ = p_dataset_seq
> AND COUNTRY_SEQ = p_country_seq
>
> The parameters (p_...) can be NULL or not, if they are they must be
> deleted.
> Infortunatly, the test for the NULL value must be like that "myField
> IS NULL" and that doesn't work if field has a value ....
> Have you a good solution?
>
> I have one but I find its not very good :
>
> DELETE (SELECT NVL(DOMAIN_SEQ,0) DOMAIN_SEQ
> ,NVL(COUNTRY_SEQ,0) COUNTRY_SEQ
> ,NVL(DATASET_SEQ,0) DATASET_SEQ
> FROM T_NOTIFICATION) N
> WHERE DOMAIN_SEQ= NVL(p_domain_seq,0)
> AND (DATASET_SEQ = NVL(p_dataset_seq, 0))
> AND (COUNTRY_SEQ = NVL(p_country_seq, 0))
>
> This solution replace NULL with 0 to test in the table and in
> parameter.
>
> Thank You!
>
> In french
>
> Bonjour,
>
> Je developpe sur Oracle 10.1
> Je voudrais supprimer des lignes dans une tables dont certains champs
> peuvent être NULL.
>
> EX :
>
> DELETE T_NOTIFICATION
> WHERE DOMAIN_SEQ=p_domain_seq
> AND DATASET_SEQ = p_dataset_seq
> AND COUNTRY_SEQ = p_country_seq
>
> Les paramètres (p_...) peuvent être NULL ou pas, si ils le sont il
> faut les tester. Malheureusement, le test pour la valeur NULL doit
> être monchps IS NULL et ca ne va pas si il y a une valeur....
>
> Avez vous une solution?
>
> J'en ai trouvée une mais qui est "sale":
>
> DELETE (SELECT NVL(DOMAIN_SEQ,0) DOMAIN_SEQ
> ,NVL(COUNTRY_SEQ,0) COUNTRY_SEQ
> ,NVL(DATASET_SEQ,0) DATASET_SEQ
> FROM T_NOTIFICATION) N
> WHERE DOMAIN_SEQ= NVL(p_domain_seq,0)
> AND (DATASET_SEQ = NVL(p_dataset_seq, 0))
> AND (COUNTRY_SEQ = NVL(p_country_seq, 0))
>
> Cette solution consite à remplacer les valeurs NULL par 0 dans les
> données à tester et dans le paramètres.

Try putting the same "translation" of null to a value to the filter:

where nvl(domain_seq,-1) = nvl(p_domain_seq, -1) and nvl(dataset_seq,-1) = nvl(p_dataset_seq,-1) ...

substitute -1 for any value that would never occur in the data itself. Received on Wed Mar 28 2007 - 12:24:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US