Re: dates and cobol - this is bizarre, not to mention irritating

From: Alan <alanshein_at_erols.com>
Date: Thu, 28 Mar 2002 11:08:24 -0500
Message-ID: <a7vevv$ojk88$1_at_ID-114862.news.dfncis.de>


Why are you using a cursor instead of straight SQL?

"Andrew" <razz_lee_at_yahoo.com> wrote in message news:6778df0f.0203280743.6964a267_at_posting.google.com...
> I have a bizarre problem. I'm trying to pull data of a table with the
> following cursor:
>
> EXEC SQL
> DECLARE C_CURSOR CURSOR FOR
> SELECT BC_GROUP_ID
> ,BC_ID_NO
> ,BC_CARD_TYPE
> ,BC_DATE_STAMP
> ,BC_NO_OF_CARDS
> ,BC_TRANS_DATE
> ,BC_LANGUAGE
> ,BC_CORP_LOGO
> ,BC_COVERAGE_LOGO
> FROM MSC_CARDSTATS
> WHERE BC_TRANS_DATE >=
> TO_DATE(:WS-TEMP-START-DT,'YYYYMMDD')
> AND BC_TRANS_DATE <
> TO_DATE(:WS-TEMP-END-DT,'YYYYMMDD')
> ORDER BY BC_TRANS_DATE
> ,BC_LANGUAGE
> ,BC_CORP_LOGO
> END-EXEC.
>
> the two host variables used to interrogate bc_trans_date are derived
> by this select:
>
> EXEC SQL
> SELECT TO_CHAR(ADD_MONTHS(SYSDATE,-1),'YYYYMMDD')
> INTO :WS-DB-START-DATE
> FROM SYS.DUAL
> END-EXEC.
>
> Now here's the catch. If I run it as is i get no data found (-1403).
> If I hardcode the date values into the host fields I get data
> returned. Whats worse, when i compare the host variable with the hard
> coded value to the host variable with the derived date (from the
> select) cobol says there the same. Does anybody know what the heck is
> going on. platform is an HP, oracle 7.3.4, compiler is micro-focus.
>
> thanks in advnace,
> Andrew
Received on Thu Mar 28 2002 - 17:08:24 CET

Original text of this message