Search This Blog

Tuesday, March 19, 2019

Comma separated value to ROWS in ORACLE SQL


SELECT t.id,
       v.COLUMN_VALUE AS value,
       ROW_NUMBER() OVER ( PARTITION BY id ORDER BY ROWNUM ) AS lvl
    FROM   prod_resource_mst t,
       TABLE(
         CAST(
           MULTISET(
             SELECT TRIM( REGEXP_SUBSTR( t.line_number, '[^,]+', 1, LEVEL ) )
             FROM   DUAL
             CONNECT BY LEVEL <= REGEXP_COUNT( t.line_number, '[^,]+' )
           )
           AS SYS.ODCIVARCHAR2LIST
         )
       ) v  where id=51

Monday, November 26, 2018

SQLSERVER: 'Concat' in SQL SERVER 2008

Example

Select a.* 
from testa a
Where (cast( a.column1 as varchar) +cast(a.column2 as varchar))    in (select  cast( b.column1 as varchar) +cast(b.column2 as varchar)  from testb b)


Sunday, June 3, 2018

Oracle Rows Generate from Column Value


Example

 Select COLUMN1,COLUMN2,
               From (
               select COLUMN1,COLUMN2,
                   regexp_substr(STRING_COLUMN,'[^,]+',1,column_value) as STR
                  from SAMPLE_TABLE
                        TABLE(cast(multiset(select level
                       from dual
                        connect by level <= length(DAYS) -
                                length(replace(DAYS,','))+1)
                               as sys.odcinumberlist))               
               )  Where ,COLUMN2=P_COLUMN2 and STR Is Not Null Order By 1,3

Friday, May 25, 2018

Oracle: Make Oracle Password Unlimited


Change the profile limit to unlimited.

SQL> alter profile DEFAULT limit PASSWORD_REUSE_TIME unlimited;

SQL> alter profile DEFAULT limit PASSWORD_LIFE_TIME  unlimited;

Wednesday, March 28, 2018

PHP: Remove all characters from a string except numerical digit


You can use following example for removing character leaving all the numerical digit

$nano_number=preg_replace('/[^0-9.]/', '', $nano_string);

Thursday, March 15, 2018

Oracle: ORA-12638-Credential Retrieval Failed

You will find original entry in $ORACLE_HOME\Network\Admin\sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES= (NTS)

You have to Change the

SQLNET.AUTHENTICATION_SERVICES= (NONE)


Your problem will be solved.

Wednesday, December 27, 2017

Oracle: Skipped locked rows in select query

Example

select * from hrm for update skip locked

By using this query, locked rows will not shown in query.