Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

How can I pass NULL as a parameter

4 posts in JDBC Connect (product renamed to JConnect) Last posting was on 1997-10-13 21:50:55.0Z
Herman Clark Posted on 1997-10-11 22:50:49.0Z
Message-ID: <344002C9.DA2064E2@rbaintl.com>
Date: Sat, 11 Oct 1997 15:50:49 -0700
From: Herman Clark <hclark@rbaintl.com>
Reply-To: hlclark@polymorphic.com
Organization: PolyMorph, Inc.
X-Mailer: Mozilla 4.0 [en] (WinNT; I)
MIME-Version: 1.0
Subject: How can I pass NULL as a parameter
X-Priority: 3 (Normal)
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 7
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:171
Article PK: 251925

How can I pass a NULL value to sybase via a stored procedure?

I've tried something like this:

setInt(param, Types.NULL)

and this :

setNull(param, Types.INTEGER)

neither seems to work.

Any insight would be appreciated.


Herman Clark Posted on 1997-10-11 23:06:56.0Z
Message-ID: <3440068F.C808DD99@rbaintl.com>
Date: Sat, 11 Oct 1997 16:06:56 -0700
From: Herman Clark <hclark@rbaintl.com>
Reply-To: hlclark@polymorphic.com
Organization: PolyMorph, Inc.
X-Mailer: Mozilla 4.0 [en] (WinNT; I)
MIME-Version: 1.0
Subject: Re: How can I pass NULL as a parameter
X-Priority: 3 (Normal)
References: <344002C9.DA2064E2@rbaintl.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 9
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:170
Article PK: 251920


Herman Clark wrote:

> How can I pass a NULL value to sybase via a stored procedure?
>
> I've tried something like this:
>
> setInt(param, Types.NULL)
>
> and this :
>
> setNull(param, Types.INTEGER)
>
> neither seems to work.
>
> Any insight would be appreciated.

Excuse me. I mean through JDBC


David Clegg Posted on 1997-10-13 18:06:31.0Z
Message-ID: <34426327.6F25E58A@sybase.com>
Date: Mon, 13 Oct 1997 11:06:31 -0700
From: David Clegg <davec@sybase.com>
X-Mailer: Mozilla 3.01 (X11; I; Linux 1.2.13 i586)
MIME-Version: 1.0
To: hlclark@polymorphic.com
Subject: Re: How can I pass NULL as a parameter
References: <344002C9.DA2064E2@rbaintl.com> <3440068F.C808DD99@rbaintl.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 16
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:168
Article PK: 251919

Looks like you have it right with the 2nd try:


PreparedStatement ps = connection.prepareStatement(
"insert into T1 values(?)");
ps.setNull(1, Types.Integer);
ps.executeUpdate();

This would insert a null.

dave

>
> Herman Clark wrote:
>
> > How can I pass a NULL value to sybase via a stored procedure?
> >
> > I've tried something like this:
> >
> > setInt(param, Types.NULL)
> >
> > and this :
> >
> > setNull(param, Types.INTEGER)
> >
> > neither seems to work.
> >
> > Any insight would be appreciated.
>
> Excuse me. I mean through JDBC


Herman Clark Posted on 1997-10-13 21:50:55.0Z
Message-ID: <344297BE.43874B51@rbaintl.com>
Date: Mon, 13 Oct 1997 14:50:55 -0700
From: Herman Clark <hclark@rbaintl.com>
Reply-To: hlclark@polymorphic.com
Organization: PolyMorph, Inc.
X-Mailer: Mozilla 4.0 [en] (WinNT; I)
MIME-Version: 1.0
Subject: Re: How can I pass NULL as a parameter
X-Priority: 3 (Normal)
References: <344002C9.DA2064E2@rbaintl.com> <3440068F.C808DD99@rbaintl.com> <34426327.6F25E58A@sybase.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.jdbcconnect
Lines: 28
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.jdbcconnect:165
Article PK: 251917


David Clegg wrote:

> Looks like you have it right with the 2nd try:
>
>
> PreparedStatement ps = connection.prepareStatement(
> "insert into T1 values(?)");
> ps.setNull(1, Types.Integer);
> ps.executeUpdate();
>
> This would insert a null.
>
> dave
>
> >
> > Herman Clark wrote:
> >
> > > How can I pass a NULL value to sybase via a stored procedure?
> > >
> > > I've tried something like this:
> > >
> > > setInt(param, Types.NULL)
> > >
> > > and this :
> > >
> > > setNull(param, Types.INTEGER)
> > >
> > > neither seems to work.
> > >
> > > Any insight would be appreciated.
> >
> > Excuse me. I mean through JDBC

Thanks for the quick reply!

What if I'm using CallableStatement as opposed to PreparedStatement.

I have cases where I pass null as an input parameters into a stored
procedure via CallableStatement These stored procedures do both
inserts, updates, selects and
deletion..

How can I tell sybase to discern between the various outcomess via the
callableStatement call?

Any insight is still appreciated.