cancel
Showing results for 
Search instead for 
Did you mean: 

Procedure for inserting a record in HANA

Former Member
0 Kudos

Hi All

I have created a table using .hdbtable definition. I have also created an .xsodata service to fetch the details of the table. The problem is when trying to insert data into the table.

For this, I created a procedure. But when I tried to activate I am getting an error which says "Invalid column name".

But the Column name which is provided is correct.

I am stuck and not able to proceed. Please help.

Thanks in advance

Meenakshi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kumar,

The screenshots of the same has been attached. I am getting an error which says, Invalid Column name for EmpId, but the column name is correct.

kakshat
Advisor
Advisor
0 Kudos

The syntax looks right. Did you make sure that the table name in the .hdbtable filename is correct (= row)?

Former Member
0 Kudos

Hi Kumar

Yes, its correct. The Table name is LogDetails and the table definition name is also LogDetails.hdbtable.

Former Member
0 Kudos

Hi Kumar

Were you able to find out what is the error ? Its blocking my development. It would really helpful if you could give any suggestion on this.

Thanks in advance

kakshat
Advisor
Advisor
0 Kudos

No Meenakshi, from what you have shared, I am unable to say what is the problem. Does the system point out the specific line that has the error? Also, I see that EmpId is the first field in the table (and therefore in the statements in the procedure). Maybe you can try removing this field from the code in the procedure and see if you still get the error or not. That will tell you whether it is actually a problem with the EmpId field or a generic problem with the syntax.

Former Member
0 Kudos

No Kumar, it wont work without the field as its the primary key field. But I am still getting the same error. Yes it is showing the line and the column position but in that position there is no error.

Anyways thanks for help

kakshat
Advisor
Advisor
0 Kudos

Ah, Ok! I forgot that's the the key field.

Which line is it showing the error in?

Former Member
0 Kudos

Hello Meenakshi,


I think the way you are passing the values for i/p is not correct.


Can you replace :row directly with the table in the select query, just to check if the problem is with input parameter. ?  


-Siva



Former Member
0 Kudos

Hi Kumar

It is showing the error in line 18, col 9 and Pos719

Former Member
0 Kudos

Hi Sivakumar,

Thanks for your reply. I will try doing that

Former Member
0 Kudos

Hi All

Instead of using a procedure, I tried to achieve the same using server side js. I created a .xsjs file and tried to connect to DB to insert values. But here also no luck. There is an error popping in the insert statement.

Here is the screenshot of the problem. Any suggestions ?

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Seems relatively straightforward to me. The error says not enough values.  I count 13 columns in your table and only 11 in your insert statement.

Former Member
0 Kudos

Hi Thomas

Thanks for your reply. I tried passing all the values. But again I am getting the following error.

But I am passing all the values.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

This also seems like the error message is pretty dead on. It says the EmpId field can't be null. Therefore it would seem your EmpId variable in the setString must be null. You don't show the whole code block so we can't see where this variable is coming from; but from the error that would certainly seem to be the source of this problem.

But going back to your original problem in the SQLScript procedure: If you are going to use mixed case columns, they you have to put the column names in quotes. That's the source of that original error.

Former Member
0 Kudos

Thanks Thomas. I am new to sap ui5 as well as hana, so I am finding little difficult to follow.

I will follow the steps and try to work on the procedure

Former Member
0 Kudos

Not sure if it's the same for a stored procedure, but in the SQL console in HANA Studio, if you put double quotes around your values in the insert statement instead of single quotes, you get this invalid column name error.

Former Member
0 Kudos

Hi Andy

thanks for your response. When you have Columns with camel casing in your procedure you need to put your column names in double quotes. This worked for me and I was able to insert values into the table without any issues.

Answers (1)

Answers (1)

kakshat
Advisor
Advisor
0 Kudos

Can you post screenshots of your table definition and the procedure you've written to insert a record?