CREATE OR REPLACE FUNCTION LEFT
(String CHAR, Pole CHAR) RETURN CHAR IS
string_length INTEGER;
length INTEGER;
temp VARCHAR2(2);
leftstring VARCHAR2(100);
column_count INTEGER;
BEGIN
SELECT LENGTHB(String) INTO string_length FROM DUAL;
column_count := 0;
IF String is null THEN
RETURN NULL;
END IF;
FOR i IN 1..32760 LOOP
column_count := column_count + 1;
SELECT SUBSTR(String,column_count, 1) INTO temp FROM DUAL;
IF temp = Pole THEN
SELECT SUBSTR(String, 1, column_count - 1) INTO leftstring FROM DUAL;
RETURN leftstring;
END IF;
IF i = string_length THEN
EXIT;
END IF;
END LOOP;
RETURN NULL;
END LEFT;
(String CHAR, Pole CHAR) RETURN CHAR IS
string_length INTEGER;
length INTEGER;
temp VARCHAR2(2);
leftstring VARCHAR2(100);
column_count INTEGER;
BEGIN
SELECT LENGTHB(String) INTO string_length FROM DUAL;
column_count := 0;
IF String is null THEN
RETURN NULL;
END IF;
FOR i IN 1..32760 LOOP
column_count := column_count + 1;
SELECT SUBSTR(String,column_count, 1) INTO temp FROM DUAL;
IF temp = Pole THEN
SELECT SUBSTR(String, 1, column_count - 1) INTO leftstring FROM DUAL;
RETURN leftstring;
END IF;
IF i = string_length THEN
EXIT;
END IF;
END LOOP;
RETURN NULL;
END LEFT;