Solved

Pro*C Date Problem

Posted on 2004-09-20
2
1,468 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 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Subquery in Oracle: Sub queries are one of advance queries in oracle. Types of advance queries: •      Sub Queries •      Hierarchical Queries •      Set Operators Sub queries are know as the query called from another query or another subquery. It can …
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…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

747 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now