Hi All,
I have a problem with Perl DBI using the Nullable property..
I have a table I created - DDL below, that has not null on all fields.
Now according to the DBI Manual, preparing a statement and executing it,
should
give 0, 1 or 2 depending on the nullability of the field.
My code seems to either give undef or space.
Code that does the select is included.
Any help please.????
Regs,
Kevin Ansett
********************************************************************
Visit our Internet site at http://www.rbsmarkets.com
This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
********************************************************************
CREATE TABLE dbo.security
(
ctrpty_id udt_id NOT NULL,
fgs char(2) NOT NULL,
fac_type_code char(3) NOT NULL,
limit_amt float NOT NULL,
limit_ccy char(4) NOT NULL,
limit_sterling float NOT NULL,
bal_sheet_id int NOT NULL,
sec_type_code char(4) NOT NULL,
sec_subtype_code char(4) NOT NULL,
sec_cntry_code char(3) NOT NULL,
sec_amt float NOT NULL,
sec_ccy_code udt_ccy_code NOT NULL,
sec_sterling float NOT NULL,
sec_unlimited char(1) NOT NULL,
sec_start_date datetime DEFAULT '01-jan-9999' NOT NULL,
sec_term char(4) NOT NULL,
sec_expiry_date datetime DEFAULT '01-jan-9999' NOT NULL,
guarantor_id int NOT NULL,
guarantor_fgs char(10) NOT NULL,
sec_item_id int NOT NULL,
audit_item_id int NOT NULL
)
LOCK ALLPAGES
WITH EXP_ROW_SIZE=1
go
$sql = "SELECT *
FROM security
WHERE 1 = 0";
$sth = $dbh->prepare($sql);
$sth->execute();
$num_fields = $sth->{NUM_OF_FIELDS};
for (my $i = 0; $i < $num_fields; $i++) {
my $nullable = $sth->{NULLABLE}->[$i];
print STDERR "DEBUG $nullable < $sth->{NULLABLE}->[$i]>\n";
push (@null_fields, $nullable);
print STDERR" <@null_fields>\n";;
print STDERR" <$sth->{NAME}->[$i]\n";
}