SAP HANA SQLScript
Strings & Regular Expressions
27 flashcards · answers and spaced-repetition review in the KnowCard app
What's wrong with putting FORMAT('{0}', val) in a SELECT field list?
Why can't you write TABLE_SUMMARY((SELECT * FROM tasks))?
What is A3 after this?
```
(A1,A2,A3) = STRING_LIB:SPLIT(
'ABC-DEF-GHI-JKL', '-', 2);
```
You declare a column as col NVARCHAR with no length. What length does it get?
What does a negative <start> do in LOCATE(str, search, start)?
What does LPAD('ABC',8,'begin') return?
What does this return with TRIM?
```
TRIM(BOTH 'HIA'
FROM 'ABCDEFGHI')
```
Why does WHERE LIKE_REGEXPR(lastname, 'M.yer') throw a syntax error?
What does this return with ASCII?
```
SELECT ASCII('A'), CHAR(65)
FROM dummy;
```
With ABAPVARCHARMODE = 'TRUE', what is the value of the literal ' ' (a single space)?
What does this return for name = 'Broadcom Ltd.'?
```
SUBSTR_REGEXPR(
'PLC|Ltd.|SE|AG' IN name)
```
How do you extract just the host part of an email that a regex matched?
```
SUBSTR_REGEXPR(
'(user)@(host)' FLAG 'i'
IN line GROUP 2)
```
What does this produce for names = 'Joerg Brandeis'?
```
REPLACE_REGEXPR(
'([[:graph:]]+) ([[:graph:]]+)'
IN names
WITH 'Last: \2 First: \1')
```
What does this return (case 2)?
```
SELECT LENGTH(''),
LENGTH('Jörg')
FROM dummy;
```
An ALPHANUM(4) column holds '12', '012', and '0012'. After ORDER BY, how do they compare?
Can you declare a procedure variable of type SHORTTEXT(20)?
Your on-prem code uses TO_ALPHANUM() and VARCHAR columns. What breaks on SAP HANA Cloud?
In a WHERE clause on a CLOB/NCLOB/TEXT column, which comparisons are allowed?
In SQLScript, does 'A ' || ' B' trim the spaces the way ABAP would?
When does ABAP_UPPER(x) differ from UPPER(x)?
A table has col VARCHAR(4). Which INSERTs fail?
```
INSERT ... VALUES ('abcd');
INSERT ... VALUES ('Jörg');
INSERT ... VALUES ('öö');
```
What does this return with SUBSTRING?
```
SELECT SUBSTRING('ABCDEFGHI',4,3)
FROM dummy;
```
SUBSTR_AFTER('abc','xyz') finds no match. What does it return?
In the book's email regex, what does \b actually match?
What happens here?
```
(A1,A2,A3) =
STRING_LIB:SPLIT('ABC-DEF','-');
```
What are A1, A2 after this?
```
(A1,A2) = STRING_LIB:SPLIT_REGEXPR(
'ABC-DEF', '[A-Z]-[A-Z]');
```
Which FLAG values do the *_REGEXPR functions accept, and what does each do?
Start learning today
Free to start — download the app or use it in your browser.
