cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
301
Views
0
Helpful
3
Replies

Issue with DB Write step in IVR Script - Problem using variable for insert

bvanbenschoten
Level 5
Level 5

I'm using the following syntax to write to a database in a IVR script.

INSERT INTO call_log

(callMSGNum,callTelNumber)

VALUES

('12','555-1212')

The above works fine, However when I substitute the variable name instead of the straight text the write doesn't work.

Is there a syntax issue that I'm missing? All the docs that I find show examples of writing actual values not variables.

I'm substituting the variable name for the values listed above. If I leave the quotes then I get the variable NAME inserted in to the database. If I remove the quotes the insert fails.

Any ideas ?

3 Replies 3

jasyoung
Level 7
Level 7

Don't use quotes, and prefix the variables with dollar signs. Your query should look like this:

INSERT INTO call_log

(callMSGNum, callTelNumber)

VALUES

($msgNumber, $telephoneNumber)

where msgNumber and telephoneNumber are either String or Integer variables (depending on your database schema).

Thanks for tip, I wasn't sure of the syntax.

Here is what I have now.

INSERT INTO call_log

(MessageNumber,callTelNumber)

VALUES

($MessageDigitsChosen,$CallingNumber)

When I test that I get the following error:

Remote Error java.lang.NullPointerException

I have the columns in SQL defined as type 'varchar' length 50 Do you think I have a type mismatch ?

Or could it be something else

Hi,

Are you trying to insert Null values into the table which doesnot allow nulls? Also check if you have configured the DB subsystem and the same is in-service.

Regards

Yogi