![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
#4
| |||
| |||
|
|
db_length - 1) = ADF_NVL_BIT) /* This macro sets a nullable data value to the null value. It |
|
Hi Ian, Yes OME (and all normal) functions won't take nulls as input parameters, but what about returning a null value? Although, other that an aggregate function I couldn't honestly think of a reason to return a null. I'm interested in what Chenzen is trying to achieve. Marty -----Original Message----- From: info-ingres-boun... (AT) kettleriverconsulting (DOT) com [mailto:info-ingres-boun... (AT) kettleriverconsulting (DOT) com] On Behalf Of Ian Kirkham Sent: 11 March 2009 10:06 To: Ingres and related product discussion forum Subject: Re: [Info-Ingres] how to return a null value in OME? If you are worried about being passed a NULL parameter then don't as you won't. The DBMS will short-circuit expressions in general that would otherwise need to propagate NULLs. Regards, Ian -----Original Message----- From: info-ingres-boun... (AT) kettleriverconsulting (DOT) com [mailto:info-ingres-boun... (AT) kettleriverconsulting (DOT) com] On Behalf Of zhenchen17 Sent: 11 March 2009 08:50 To: info-ing... (AT) kettleriverconsulting (DOT) com Subject: [Info-Ingres] how to return a null value in OME? Hi everyone, I wonder how to return a null value in OME. The struture II_DATA_VALUE used in OME is without a member variable to indicate it is representing a null value. So how can i do if i want to return a null in OME? Thanks. Chenzhen _______________________________________________ Info-Ingres mailing list Info-Ing... (AT) kettleriverconsulting (DOT) comhttp://www.kettleriverconsulting.com/mailman/listinfo/info-ingres _______________________________________________ Info-Ingres mailing list Info-Ing... (AT) kettleriverconsulting (DOT) comhttp://www.kettleriverconsulting.com/mailman/listinfo/info-ingres |
#5
| |||
| |||
|
|
Hi Ian, Yes OME (and all normal) functions won't take nulls as input parameters, but what about returning a null value? Although, other that an aggregate function I couldn't honestly think of a reason to return a null. I'm interested in what Chenzen is trying to achieve. Marty -----Original Message----- From: info-ingres-bounces (AT) kettleriver...ting (DOT) com [mailto:info-ingres-bounces (AT) kettleriverconsulting (DOT) com] On Behalf Of Ian Kirkham Sent: 11 March 2009 10:06 To: Ingres and related product discussion forum Subject: Re: [Info-Ingres] how to return a null value in OME? If you are worried about being passed a NULL parameter then don't as you won't. The DBMS will short-circuit expressions in general that would otherwise need to propagate NULLs. Regards, Ian -----Original Message----- From: info-ingres-bounces (AT) kettleriver...ting (DOT) com [mailto:info-ingres-bounces (AT) kettleriverconsulting (DOT) com] On Behalf Of zhenchen17 Sent: 11 March 2009 08:50 To: info-ingres (AT) kettleriverconsulting (DOT) com Subject: [Info-Ingres] how to return a null value in OME? Hi everyone, I wonder how to return a null value in OME. The struture II_DATA_VALUE used in OME is without a member variable to indicate it is representing a null value. So how can i do if i want to return a null in OME? Thanks. Chenzhen |
#6
| |||
| |||
|
|
Hi Marty and all, The problem seems easy in OpenAPI because there is a member variable to indicate. ![]() What i am doing is to return null value. For example, our datatype st_point either could be a 2-dimension point(x, y) or be a 3-dimension point(x,y,z). The function get_z_value is trying to fetch the z value from the point given. But for a 2d point, there is no z value anymore, so returning any value(such as 0 or -1) will cause confusion because it will be regarded as a reasonable value. Null is the proper value to return. |
#7
| |||
| |||
|
|
Hi Ian, Yes OME (and all normal) functions won't take nulls as input parameters, but what about returning a null value? Although, other that an aggregate function I couldn't honestly think of a reason to return a null. I'm interested in what Chenzen is trying to achieve. Marty -----Original Message----- From: info-ingres-bounces (AT) kettleriver...ting (DOT) com [mailto:info-ingres-bounces (AT) kettleriverconsulting (DOT) com] On Behalf Of Ian Kirkham Sent: 11 March 2009 10:06 To: Ingres and related product discussion forum Subject: Re: [Info-Ingres] how to return a null value in OME? If you are worried about being passed a NULL parameter then don't as you won't. The DBMS will short-circuit expressions in general that would otherwise need to propagate NULLs. Regards, Ian -----Original Message----- From: info-ingres-bounces (AT) kettleriver...ting (DOT) com [mailto:info-ingres-bounces (AT) kettleriverconsulting (DOT) com] On Behalf Of zhenchen17 Sent: 11 March 2009 08:50 To: info-ingres (AT) kettleriverconsulting (DOT) com Subject: [Info-Ingres] how to return a null value in OME? Hi everyone, I wonder how to return a null value in OME. The struture II_DATA_VALUE used in OME is without a member variable to indicate it is representing a null value. So how can i do if i want to return a null in OME? Thanks. Chenzhen |
#8
| |||
| |||
|
|
A few misconceptions here. First, a null is indicated by the last byte of a nullable value being nonzero. Nullable types have negative type codes. So, for example, a nullable i4 would have db_datatype of -II_INTEGER (using OME style names), a db_length of 5 instead of the non-nullable 4, and the 5th byte of the value would be zero for a non-null value and nonzero for NULL. Second, you can indeed pass nullable parameters to OME functions. but you need to define the function instance with the II_FID_F256_NONULLSKIP flag. If you don't use that flag, the query compiler assumes that the function should be treated like an operator instead of an ordinary function, and any null input skips the function call entirely giving a null result. The NONULLSKIP flag tells it to just pass the parameters, whatever they are, and let the function worry about it. Third, simply define the FI with a negative result type, meaning nullable, and you can return nulls. Karl On Mar 11, 2009, at 6:20 AM, Martin Bowes wrote: Hi Ian, Yes OME (and all normal) functions won't take nulls as input parameters, but what about returning a null value? Although, other that an aggregate function I couldn't honestly think of a reason to return a null. I'm interested in what Chenzen is trying to achieve. Marty -----Original Message----- From: info-ingres-boun... (AT) kettleriverconsulting (DOT) com [mailto:info-ingres-boun... (AT) kettleriverconsulting (DOT) com] On Behalf Of Ian Kirkham Sent: 11 March 2009 10:06 To: Ingres and related product discussion forum Subject: Re: [Info-Ingres] how to return a null value in OME? If you are worried about being passed a NULL parameter then don't as you won't. The DBMS will short-circuit expressions in general that would otherwise need to propagate NULLs. Regards, Ian -----Original Message----- From: info-ingres-boun... (AT) kettleriverconsulting (DOT) com [mailto:info-ingres-boun... (AT) kettleriverconsulting (DOT) com] On Behalf Of zhenchen17 Sent: 11 March 2009 08:50 To: info-ing... (AT) kettleriverconsulting (DOT) com Subject: [Info-Ingres] how to return a null value in OME? Hi everyone, I wonder how to return a null value in OME. The struture II_DATA_VALUE used in OME is without a member variable to indicate it is representing a null value. So how can i do if i want to return a null in OME? Thanks. Chenzhen |
![]() |
| Thread Tools | |
| Display Modes | |
| |