SQLTeam.com | Weblogs | Forums

Syntactical error in the below snippet - error message is SQL Error [4856] [42601]: [VJDBC](4856) ERROR: Syntax error at or near "SELECT"

insert into DTPVTR.ManagementReporting_Usage_02PREPAID_Aftersharing_RPT

SELECT CAST ( TO_CHAR ( A.DAY_ID ,'YYYYMM' ) AS INT ) AS MNTH_ID ,
'Prepaid' AS ACCT_TYPE ,
A.AOU_SEG ,
SUM ( ( CAST( A.REVN AS DEC ( 38 , 6 ) ) * ( ( ( 100.000000 - 6.000000 ) / 100.000000 ) ) ) + ZEROIFNULL ( A.TOURIST_SIM_SVC_REVN_AMT ) + ZEROIFNULL ( A.OTHER_SIM_SVC_REVN_AMT ) ) AS REV_AMT,
--CAST (DTPVTA.CLSTR_DAIL_SUBR_PP_REVN.DAY_ID AS DATE),
SELECT CAST ( TO_CHAR ( A.DAY_ID ,'YYYYMM' ) AS INT ) AS MNTH_ID ,
CURRENT_DATE
FROM DTPVTA.CLSTR_DAIL_SUBR_PP_REVN A
--WHERE CAST( ( A.DAY_ID(FORMAT 'YYYYMM' )( CHAR ( 6 ) ) ) AS INT ) IN @prompt('Enter value(s) for Month:','N',,Multi,Free,Not_Persistent,,User:0)
GROUP BY 1 , 2 , 3

Put the SELECT statement inside brackets and try.