Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bound variable error

Status
Not open for further replies.

t16turbo

Programmer
Mar 22, 2005
315
GB
hi there,
I have some code in the text editor of my report:
Code:
SELECT 
NBI_PROJECT_CURRENT_FACTS.CUSTOMER,
NBI_PROJECT_CURRENT_FACTS.CUSTOMER_CODE, 
ODF_CA_PROJECT.DSTI_TRUE_CLIENT3, 
SRM_COMPANIES.COMPANY_NAME,  
PROJCLASS.DESCRIPTION,
dsti_proj_ref,
dsti_proj_act,
SUM(PRTIMEENTRY.PRACTSUM/3600)

FROM
PRTIMESHEET,
PRTIMEENTRY,
PRTIMEPERIOD,
PRCHARGECODE,
SRM_PROJECTS,
SRM_RESOURCES,
ODF_CA_PROJECT,
PRASSIGNMENT,
PRTASK,
PAC_MNT_RESOURCES,
NBI_PROJECT_CURRENT_FACTS,
SRM_COMPANIES,
NBI_DIM_OBS,
NBI_RESOURCE_CURRENT_FACTS,
PROJCLASS

WHERE
PROJCLASS.PROJCLASS = NBI_PROJECT_CURRENT_FACTS.PROJECT_CLASS
AND nbi_RESOURCE_CURRENT_FACTS.RESOURCE_ID = srm_resources.ID
AND nbi_resource_current_facts.obs1_unit_id = nbi_dim_obs.obs_unit_id
AND ODF_CA_PROJECT.DSTI_TRUE_CLIENT3 = SRM_COMPANIES.COMPANY_ID (+) 
AND NBI_PROJECT_CURRENT_FACTS.PROJECT_ID = SRM_PROJECTS.ID (+) 
AND PRTASK.PRID = PRASSIGNMENT.PRTASKID
AND PRASSIGNMENT.PRID = PRTIMEENTRY.PRASSIGNMENTID
AND PRTIMEENTRY.PRCHARGECODEID = PRCHARGECODE.PRID
AND PRTIMEENTRY.PRTIMESHEETID = PRTIMESHEET.PRID
AND PRTIMESHEET.PRTIMEPERIODID = PRTIMEPERIOD.PRID
AND PRTIMESHEET.PRRESOURCEID = SRM_RESOURCES.ID
AND PRTASK.PRPROJECTID = SRM_PROJECTS.ID
AND SRM_PROJECTS.ID = ODF_CA_PROJECT.ID
AND PAC_MNT_RESOURCES.ID = SRM_RESOURCES.ID
AND PRTIMESHEET.PRSTATUS IN (  3, 4)
AND NBI_PROJECT_CURRENT_FACTS.IS_ACTIVE = 1[code]

In the ObtainSelectStatement I then add to the where clause and add the group by.

as soon as I do this (which I need to in order for the aggregate function in the SELECT statement to work)
I get the error:
"Datatypes of the bound variable and column are not compatible"
If I take out the aggregate function it works perfectly well.

If I dont add parameters in the ObtainSelectStatement, and just have the entire query in the text editor (with aggregates and group by) it works fine..

can anyone suggest where I am going wrong?

thanks in advance
 
Use an alias for the aggregate function as follows:

SUM(PRTIMEENTRY.PRACTSUM/3600) as PRACTSUM

I assume that PRACTSUM is the column name in the datarow that corresponds to the aggregate column in the query.

If you have defined another name, use that name as alias.

I hope this helps.

-- JB

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top