Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Pro*C Date Problem

Posted on 2004-09-20
2
Medium Priority
?
1,589 Views
Last Modified: 2012-06-27
Hi!

I have a date field in the database which I am trying to extract into a variable.

The variable to hold the data is defined as a char[20].

The function is:

int getNTLAllocations(accstmt_t* pAccStmt)
{

  char msg[STR255+1];


  EXEC SQL BEGIN DECLARE SECTION;
     char AccountNum[11+1];
     EXEC SQL VAR AccountNum IS STRING;
     int BillSeq;
     int Amount;
     char PaymentDate[20];
     EXEC SQL VAR PaymentDate IS STRING;
     short AccountPaymentSeq;
  EXEC SQL END DECLARE SECTION;

  strcpy(AccountNum, pAccStmt->ntlAccountNum);
  AccountNum[11] = '\0';
  PaymentDate[20] = '\0';


  BillSeq = pAccStmt->ntlBillSeq;


  EXEC SQL DECLARE accountpayments_cursor CURSOR FOR
     SELECT atb.amount_mny, ap.account_payment_dat
     FROM allocationtobill atb, accountpayment ap
     WHERE atb.account_num = :AccountNum
     AND   atb.bill_seq = :BillSeq
     AND   ap.account_num = atb.account_num
     AND   ap.account_payment_seq = atb.account_payment_seq;


  EXEC SQL OPEN accountpayments_cursor;
     EXEC SQL FETCH accountpayments_cursor INTO :Amount :PaymentDate ;
  EXEC SQL CLOSE accountpayments_cursor;


When i compile it I get:

Semantic error at line 791, column 58, file gpp_dbutil.pc:
     EXEC SQL FETCH accountpayments_cursor INTO :Amount :PaymentDate ;
.........................................................1
PCC-S-02367, This indicator variable must be declared as type short
make: The error code from the last command is 1.

I dont understand why this would have to be a datatype "short". Can anyone help?

Julian
0
Comment
Question by:stummj
  • 2
2 Comments
 
LVL 9

Accepted Solution

by:
pratikroy earned 200 total points
ID: 12103318
Instead of
EXEC SQL FETCH accountpayments_cursor INTO :Amount :PaymentDate ;

You should have :

EXEC SQL FETCH accountpayments_cursor INTO :Amount, :PaymentDate ; /* Note the comma between two variables */

I believe you don't wish to keep/check the indicator variables, but by the syntax, it thinks that you are trying to populate the indicator variable :PaymentDate, which should be of type short. Ignore that error, and just put the comma. It should work !

Hope this helps !

0
 
LVL 9

Expert Comment

by:pratikroy
ID: 12103350
Now, don't ask what an indicator variable is. If you wish to know about it though, then refer to : http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a97269/pc_02prc.htm#1066
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question