Table of Contents

Search

  1. About the Data Vault SQL Reference
  2. Introduction to SQL Reference for Informatica Data Vault
  3. Date and Time Arithmetic
  4. WHERE Clauses
  5. UNION Operator
  6. Parameterized Query
  7. Functions

Data Vault SQL Reference

Data Vault SQL Reference

POSITION

POSITION

A string function that returns the starting position of a string
value-expression1
within another string
value-expression2
. The Data Vault Service evaluates the position of the string from left to right, starting at position 1. If
value-expression1
is not found, POSITION returns 0. If
value-expression1
occurs more than once within
value-expression2
, POSITION returns the starting position of the last occurrence of
value-expression1
.
The POSITION function is similar to the POSSTR function. Both functions return the position of a substring within a string.

POSITION Syntax

POSITION ( char value-expression1 IN char value-expression2 )

POSITION Example 1

In this example,
value-expression1
occurs once within
value-expression2
. POSITION returns the starting position of
value-expression1
.
Input
Output
'fun' IN 'malfunction'
4
CREATE TABLE string_table (col1 VARCHAR(20)); INSERT INTO string_table VALUES ('malfunction'); 1 row affected SELECT POSITION('fun' IN col1) FROM string_table; 1 row selected 1 ----------- 4

POSITION Example 2

In this example,
value-expression1
occurs more than once within
value-expression2
. POSITION returns the starting position of the last occurrence of
value-expression1
.
Input
Output
'4' IN '4234.23423'
8
CREATE TABLE string_table (col1 VARCHAR(20)); INSERT INTO string_table VALUES ('4234.23423'); 1 row affected SELECT POSITION('4' IN col1) FROM string_table; 1 row selected 1 ----------- 8

0 COMMENTS

We’d like to hear from you!