COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Report Studio => Topic started by: sakthivelmani on 28 Jul 2015 03:16:03 PM

Title: Datatype of an oracle table field changes when pulled into cognos as custom sql
Post by: sakthivelmani on 28 Jul 2015 03:16:03 PM
Hi All,

I am trying to write a report using Custom sql. The original datatype of the Oracle table fields are changed when i pull them into report studio using custom sql. Is there any way , i can bring the fields with their original datatype. I need this because my template alignment settings will only work if the datatype is correct. Please let me know if you guys have come across a situation like this.

Thank you all in advance,
Sakthi
Title: Re: Datatype of an oracle table field changes when pulled into cognos as custom sql
Post by: gpollock on 28 Jul 2015 03:23:48 PM
In your custom SQL query, are you explicitly casting the data items to the desired types, or are you having Cognos "guess"?
Title: Re: Datatype of an oracle table field changes when pulled into cognos as custom sql
Post by: sakthivelmani on 11 Aug 2015 03:34:20 PM
I am not casting the datatypes.
Title: Re: Datatype of an oracle table field changes when pulled into cognos as custom sql
Post by: gpollock on 11 Aug 2015 03:37:48 PM
That's your problem.  When you run custom sql, cognos will look at a sample of the results and guess at what the datatype should be.  Sometimes it guesses correctly, and sometimes it doesn't--it's usually related to the sample of the results.

Try casting the fields that you need to be a certain data type.  Either in your sql query, or change the data type of the individual data items.
Title: Re: Datatype of an oracle table field changes when pulled into cognos as custom sql
Post by: bdbits on 12 Aug 2015 05:18:10 PM
I would note that if you created a proper package, you could solve this in FM one time for all reports you create. You should not normally be creating reports with SQL anyway.

Just saying....