Hi,
How will we use aggregate sql function inside proiv.
Say for eg:, I need SUM() of 1 column. Can I use SUM function inside SQL --- ENDSQL. If so, how?
Rgds Priya

Aggregate Function
Started by priya_thomas, Oct 03 2006 10:35 AM
6 replies to this topic
#3
Posted 03 October 2006 - 12:58 PM
You can use a pro-iv filedef defined as a 10-character alpha, and then on the before read logic of the file, do something like this:
SQL
SELECT TO_CHAR( SUM( COLNAME),'9999999999') AS RESULT
WHERE .....
ENDSQL
And then do a CONV(RESULT) on the no error logic
SQL
SELECT TO_CHAR( SUM( COLNAME),'9999999999') AS RESULT
WHERE .....
ENDSQL
And then do a CONV(RESULT) on the no error logic
#6
Guest_Embedded SQL in PRO-IV is Sh!_*
Posted 04 October 2006 - 02:11 PM
No, you're doing the right thing Mike although perhaps it could be a little simpler to use a numeric key and not CONV.[Wish I had known that trick earlier. (Or read the manual mabye?
)
Output (for example "INTO") host variables is officially unsupported in ProIV (big warning in the manual).
#7
Posted 13 October 2006 - 04:18 PM
We've had problems using INTO for numeric variables - they get truncated to integers.
Even this:
SQL
select numeric_column into :#VALUE where another_column = :#ANOTHER_VALUE
ENDSQL
Results in #VALUE and #ANOTHER_VALUE being truncated to integer.
I've a feeling that INTO isn't officially supported.
Tony.
Even this:
SQL
select numeric_column into :#VALUE where another_column = :#ANOTHER_VALUE
ENDSQL
Results in #VALUE and #ANOTHER_VALUE being truncated to integer.
I've a feeling that INTO isn't officially supported.
Tony.
Reply to this topic

0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users