Karen,

I have inserted null values before, provided they are allowed, without
problems. How are you pre-defining your variables? The error seems to
indicate that the variable is pre-defined but has no value; perhaps the
SELECT INTO did not find a value or found a blank values? Are you getting an
error code? Are you using an INDICATOR in your SELECT INTO and what is its
value when you run into this problem? Maybe you can use the INDICATOR value
to test and reset your variable as needed prior to the INSERT.

You can try defining:
SET VAR vBillRate REAL = NULL
Or
SET VAR vBillRate REAL – ‘-0-’

Before your SELECT INTO.

Javier,

Javier Valencia, PE
913-829-0888 Office
913-915-3137 Cell
913-649-2904 Fax

________________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of
[email protected]
Sent: Monday, March 15, 2010 10:56 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Someone test an INSERT statement for me?

A client is running build .30305, which I believe is the latest .. 

A program (run daily, untouched since 9/2009) does an insert into
a table using a combination of columns and variables.  The syntax is:

     INSERT INTO sales +
       (invoiceno, trandate, trantime, accountno, billaccount, brate) +
       SELECT invoiceno, .#DATE, .#TIME, accountno, .vmacctno, .vBillRate +
       FROM tempsales WHERE    .....

The 2 variables referenced (vmacctno and vbillrate) are predefined, and are
populated by a "select into".   However, the vBillRate could be null.  In
that
case, I see it in my variable list as
       vBillRate   REAL      with no value

I swear this must have happened before (but maybe not), but when vBillRate
is null, 
the insert fails and I get the message
       "An expression cannot end with binary operator"

If I replace the vBillRate with a 0 , then the insert works.  Whileopt is
OFF, Zero is ON.

My null setting is the default -0-.  If I change the null setting to ' '
(blank space)
right before the insert, the insert still fails but with:
       "incorrect number of values for this table"

So now I'm pretty worried about other places I might have a null variable
being
inserted...  What do other programmers do?  Is this bad programming?  Should
each variable be populated with something?  What if you want a number value
to be truly null, and not a 0?

Karen


Reply via email to