SAP HANA SQLScript
Numbers, Units & Type Conversions
20 flashcards · answers and spaced-repetition review in the KnowCard app
CONVERT_UNIT returns nothing useful on a fresh HANA box. Which ERP tables must exist, and what key must you pass?
What does currency conversion require that quantity conversion doesn't, and what sets a currency's number of decimal places?
You INSERT the two-character text 'AB' into a VARBINARY column, then SELECT it back. What do you get?
What does this return with BITSET?
```
SELECT BITSET(x'0000', 9, 4)
FROM dummy;
```
What is the difference between implicit and explicit conversion in SQLScript, and how does CAST relate to the TO_* functions?
A search uses HAMMING_DISTANCE(firstname,'Mandy') BETWEEN 0 AND 1. Why does it miss 'Mand' and 'Mandyy'?
'Nena' was mistyped as 'Bena'. Will a SOUNDEX() phonetic search match the two?
You need a column for euro amounts (17 digits, 2 decimals). DECIMAL(17,2), plain DECIMAL, or DOUBLE?
What does this return with TO_TINYINT?
```
SELECT TO_TINYINT(1000)
FROM dummy;
```
What does this return with ROUND?
```
SELECT ROUND(175, -1)
FROM dummy;
```
value2 may be 0. Of value1/value2, NDIV0(value1,value2), and MOD(value1,value2), which still throw on a zero divisor?
You need a random value to build a password-reset token. RAND() or RAND_SECURE()?
In SAP HANA, how are an amount and its currency (or a quantity and its unit) linked at the column level?
Using the default rounding mode, what does each return?
```
ROUND(2.5, 0)
ROUND(0.5, 0)
```
What do these return?
```
CEIL(-1.1)
FLOOR(-1.1)
```
The value column is INTEGER. What type and value does this return?
```
BITXOR(248, 31)
```
You pad a number to a fixed-width string with leading zeros. On overflow (value longer than the length), how do TO_ALPHANUM and TO_VARCHAR differ?
Do these two rows return the same value?
```
TO_DOUBLE(1.2)-TO_DOUBLE(0.1)
TO_SMALLDECIMAL(1.2)
-TO_SMALLDECIMAL(0.1)
```
quantity 1.0 has the unknown unit 'XYZ', and ERROR_HANDLING => 'set to null'. What comes back?
```
CONVERT_UNIT(
QUANTITY=>quantity,
SOURCE_UNIT=>unit,
TARGET_UNIT=>'KG',
ERROR_HANDLING=>'set to null')
```
You have VARBINARY data. Which function gives its hex text, and which decodes the bytes as characters?
Start learning today
Free to start — download the app or use it in your browser.
