Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: table type definitions for variables

$
0
0

hi Lars, Thanks for taking the time to respond to my question.

 

 

To make a long story short, we're trying to avoid a data type conversion when joining two CRM tables, namely but000 & crmd_partner. (link is on b.partner_guid (varbinary(16) CS_RAW to c.partner_no (NVARCHAR(32))

 

 

So I was hoping I could store the results of a reduced data set containing partner_no in a table var and then join to but000 with the same data type (and avoid the data type conversion)

 

  declare lt_vw_rslts_tab table ( MANDT NVARCHAR(3),
:
:,         PRIM_REP_PARTNER_GUID VARBINARY(16)         );

A CDS view populates lt_srch_vw table var and the partner_no value from crmd_partner table is held in a field called prim_rep_pnum

 

        /* hold intermediary results in table var, also include guid values */        lt_vw_rslts_tab  = Select v.*,                                             prim_rep_pnum as prim_rep_partner_guid                           from :LT_SRCH_VW as v;

 

So this change above fixes our perf issue, however we lose the primary rep information. Debugging the AMDP, I can see the issue lies with how the field prim_rep_partner_guid now contains a different value compared to the original NVARCHAR(32) field. It's doing a to_varbinary() conversion on it.

 

guid_comp.PNG

 

However if I bring this back to sql editor and create a test column table as such

 

create column table hollas.tst_crte_tab
( MANDT NVARCHAR(3),         DOC_NUM NVARCHAR(10),         GUID_RAW VARBINARY(16) CS_RAW);

And insert partner_no direct as so

 

insert into hollas.tst_crte_tab  (MANDT,DOC_NUM,GUID_RAW)
select top 10 client as mandt, 'DUMMY_DOC' as doc_num, partner_no as guid_raw
from sapsr3.crmd_partner
where partner_no <> ''

guid_comp1.PNG

 

In a roundabout way, this is why I believed I needed the CS_RAW extension.

 

However, as Lars suggested, the type declaration is fine, I just needed to do code a hextobin() conversion instead of the implicit to_varbinary() conversion done at runtime.

 

Message was edited by: Sean Holland

 

Message was edited by: Sean Holland


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>