cancel
Showing results for 
Search instead for 
Did you mean: 

How can i replace column name using reciever JDBC adapter on runtime.

Former Member
0 Kudos

Hi Experts,

I have a problem with reciever JDBC synario.

Target Oracle table has columns named 2 bytes Japanese character like "日本".

Datatype cannot accept 2bytes character as element name.

So, I would like to how to replace column name on runtime.

Please tell me.

Regards,

Shinya Kawaoge

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You can rename table column name with ALTER TABLE sql command.

To rename a column in an existing table, the ALTER TABLE syntax is:

ALTER TABLE table_name
 RENAME COLUMN old_name to new_name;

You can insert the ALTER TABLE command in a Stored Procedure, and call it from JDBC Channel.

Former Member
0 Kudos

Hi Shinya,

Alternatively, you can also design your receiver interface as follows:

<root>

<StatementName>

<anyName action=u201DSQL_DMLu201D>

<access>alter table <tablename> rename column <old_Column_Name> to <new_Column_Name></access>

</anyName >

</StatementName>

</root>

And this will do the trick for you.

Please take a look at the following URL for your reference:

http://help.sap.com/saphelp_nw73/helpdata/en/44/7b7855fde93673e10000000a114a6b/content.htm

Hope this helps.

Regards, Gaurav

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi experts,

I solved this problem using SQL_DML.

Thanks for replies.

Regards

Shinya Kawagoe

RaghuVamseedhar
Active Contributor
0 Kudos

Hi Shinya Kawagoe,

I understand there is a column with two Japanese characters in target database table. Now you want to UPDATE or INSERT data in that table. You do not want to rename the column name in the database table (if you want to rename column, ask the target database admin ).

As Japanese characters are not allowed in XML Data Type in ESR. You can [Define a SQL_QUERY Statement|http://help.sap.com/saphelp_nwpi711/helpdata/en/44/7b7855fde93673e10000000a114a6b/frameset.htm]. Check the Addres日本s in below code.

<root>
  <stmt>
    <Customers action="SQL_DML">
      <access> UPDATE Customers SET CompanyName=u2019$NAME$u2019, Addresu65E5u672Cs=u2019$ADDRESS$' WHERE CustomerID='$KEYFIELD$u2019
      </access>
      <key>
        <NAME>Firma</NAME>
        <ADDRESS>Strasse 3 </ADDRESS>
        <KEYFIELD>FI</KEYFIELD>
      </key>
    </Customers>
  </stmt>
</root>

Regards,

Raghu_Vamsee

former_member854360
Active Contributor
0 Kudos

Hi ,

You can use Native SQL format.

XML Document Format for the Message Protocol Native SQL Format

This protocol is primarily for test purposes only. Instead of an XML document format, a text is expected that represents any valid SQL statement.

When inserting a line into a table the corresponding document looks as follows:

u201E

INSERT INTO tableName (column-name1, column-name2, column-name3) VALUES(u2018column-value1u2019, u2018column-value2u2019, u2018column-value3u2019)

u201C

Refer this docs last section

http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm