Follow by Email

Wednesday, January 11, 2017

ORA-06504: PL/SQL: Return types of Result Set variables or query do not match

This problem took sometime to be resolved and I am sharing here the reason and solution

Problem :

I was getting this exception in my oracle code
ORA-06504: PL/SQL: Return types of Result Set variables or query do not match

Reason :

I was trying to load data in a sys ref cursor , and later in a loop I was trying to fetch this cursor in a row type. Declration for my row type was

v_student_row          Student_TBL%rowtype;

I was loading data into the cursor using below query

select,t.roll_no,t.email_address from Student_TBL t

and later was

        fetch v_student_cur
          into v_student_row;

where Student_TBL had below column


When trying to fetch I was getting
ORA-06504: PL/SQL: Return types of Result Set variables or query do not match

The reason was I was not selecting all columns in my select query , so when trying to assign the data in my cursor to the row_type oracle was throwing above error.

Solution :

Once the problem was understood solution was very easy i.e. to select * from student table not few columns.

Tuesday, November 29, 2016

Origin http://localhost:4200 not found in Access-Control-Allow-Origin header.

In my angularjs 2 application I am using a restful service

When I try to call this service I get below error

Origin http://localhost:4200 not found in Access-Control-Allow-Origin header.

All solutions were suggesting to add  No 'Access-Control-Allow-Origin' header which was not an option for me because I had no control on the server.

For my case the reason was the network (My office network) to which I was connected it was not allowing this port for some reason.


Changed the network and it was working fine :).

Monday, October 17, 2016

org.springframework.jdbc.BadSqlGrammarException CallableStatementCallback; bad SQL grammar

I was getting below exception in my code where my query in the function was perfectly working fine in oracle but in java code giving me this error

org.springframework.jdbc.BadSqlGrammarException: CallableStatementCallback; bad SQL grammar [{call schema.package.function(?, ?, ?)}]; nested exception is java.sql.SQLException: Invalid column name

Thanks to this thread

I noticed there  was no ORA error message in the exception , which means the call was executed successfully in JDBC level , and than I had to check my mapper defined for this execution there I was trying to get  a column from resultset which was not selected in the original query hence the problem " java.sql.SQLException: Invalid column name"

I added the missing column in my query and got rid of this exception. Good Lesson Learned.

Lesson Learned : If there is no ORA error in your exception chances are that the JDBC call was ok and now something wrong in your java code .

Saturday, October 15, 2016 Broken pipe

Reason :

I was facing this exception when I was trying to create a resultset with a lot of records in it , later I found the data set was so huge that even in PL/SQL it was showing memory issues.

Solution :

I had to restrict my query to be executed for a specific date range which user may select and warn the user about any possible issues when the date is very long.

Saturday, September 3, 2016

Remove padding beneath H3,h2,ui tag

I was developing a printer friendly HTML page and was facing a problem where H2,h3 and ui tags were adding extra spaces at top and bottom of the text.

Thanks to the below stackoverflow answer I found out that there is a default margin and padding in these tags and had to write a small css to override those

h3{ padding: 0px; margin: 0px; }
ui{ margin: 0px; }

notice that I am not using padding:0 for ui because if I do it is going to remove the padding and my ui will not appear aligned with the border which I don't want.

Sunday, June 12, 2016

Where does Eclipse copy our web application after deployment?

Thanks to below stackoverflow thread I was able to find it quickly , keeping it in my blog so that it is easy to search in future.

Below is copy pasted from above link

go to your application work space directory(not eclipse installation directory) in windows explorer(not in eclipse IDE explorer).

Here under the .metadata folder you will find your application under below path


Wednesday, May 18, 2016

How to ignore zero decimal place values in Crystal Reports

I had this requirement where I wanted to show a decimal number with 2 decimal points in my report but when there is no decimal value I wanted to show the integer part only i.e.

I wanted to show


instead of
50.00 (default behavior)

I had to define a custom formula for this

here is the procedure

  1. right click on your field in crystal report
  2. Format field
  3. Click on Number tab
  4. Press customize button
  5. Define a formula for Decimals as below
Crystal Report Formula
if CurrentFieldValue - truncate(CurrentFieldValue) <> 0 then

This basically means that if the current value has no decimals show 0 or no decimal places , else show 2.

Thanks to an answer in below stackoverflow thread from where I got to know about "CurrentFieldValue "