Skip to main content

Posts

Showing posts with the label Oracle

Remove Special Character and Extra Space From a String ORACLE/PLSQL

Remove Special Character and Extra Space From a String ORACLE/PLSQL Removing special character using REGEXP: SELECT REGEXP_REPLACE('Sahay*)(^#@Pandey$ashish/Vikas','[^a-z_A-Z ]') FROM DUAL; Remove extra spaces between string using REGEXP: SELECT REGEXP_REPLACE ('Vikas                      Pandey from              Delhi', '[[:blank:]]+', ' ') FROM DUAL; Related Post:  How to Remove New line from a String Using PL/SQL/ORACLE

Pipelined Functions in Oracle

How to create Pipelined Functions in Oracle?  Pipeline functions are used to return data in tabular format. It returns the data in the nested table type. Pipeline functions are useful to dump data derived from the complex queries. Create the types  CREATE TYPE g_emp_row AS OBJECT (    empno NUMBER (4),    ename VARCHAR2 (10 BYTE),    job VARCHAR2 (9 BYTE),    mgr NUMBER (4),    hiredate DATE,    sal NUMBER (7, 2),    comm NUMBER (7, 2),    deptno NUMBER (2) ); / CREATE TYPE g_emp_tab IS TABLE OF g_emp_row; / Pipeline function  CREATE OR REPLACE FUNCTION get_employees (pi_deptno IN NUMBER)    RETURN g_emp_tab    PIPELINED AS    CURSOR c_get_emp (p_deptno NUMBER)    IS       SELECT empno,                         ename,                 ...