Sunday, 17 November 2024

Oracle SQL + How to split a string in Oracle using substr/instr

 Table Name: GLCC

Column Name: criteria

Column Value: ALAM-**-98000-10301990-***-***************-*****-OPR**

SELECT

   criteria,INSTR(criteria,'-',1,1) AS first_comma,

   INSTR(criteria,'-',1,2) AS second_comma,

   INSTR(criteria,'-',1,3) AS third_comma

   ,INSTR(criteria,'-',1,4) AS fourth_comma,

   INSTR(criteria,'-',1,5) AS fifth_comma,

   SUBSTR(criteria,1,INSTR(criteria,'-',1,1)-1) column1

   ,SUBSTR(criteria

             ,INSTR(criteria,'-',1,1) + 1

             ,INSTR(criteria,'-',1,2)

              - INSTR(criteria,'-',1,1)

              - 1)

       AS column2

         ,SUBSTR(criteria

             ,INSTR(criteria,'-',1,2) + 1

             ,INSTR(criteria,'-',1,3)

              - INSTR(criteria,'-',1,2)

              - 1)

       AS column3       

                ,SUBSTR(criteria

             ,INSTR(criteria,'-',1,3) + 1

             ,INSTR(criteria,'-',1,4)

              - INSTR(criteria,'-',1,3)

              - 1)

       AS column4  

                       ,SUBSTR(criteria

             ,INSTR(criteria,'-',1,4) + 1

             ,INSTR(criteria,'-',1,5)

              - INSTR(criteria,'-',1,4)

              - 1)

       AS column5 

                       ,SUBSTR(criteria

             ,INSTR(criteria,'-',1,5) + 1

             ,INSTR(criteria,'-',1,6)

              - INSTR(criteria,'-',1,5)

              - 1)

       AS column6

                       ,SUBSTR(criteria

             ,INSTR(criteria,'-',1,6) + 1

             ,INSTR(criteria,'-',1,7)

              - INSTR(criteria,'-',1,6)

              - 1)

       AS column7

             ,SUBSTR(criteria

             ,INSTR(criteria,'-',1,7) + 1)

       AS column8

              FROM

    glcc;  

1 comments:

Rahulagarwal said...

FundedFirm has positioned itself as a top contender among MT5 Prop Firms, offering traders unparalleled opportunities to access real funding and trade global markets confidently. Powered by the MetaTrader 5 platform, FundedFirm provides the ultimate trading environment featuring fast execution, deep liquidity, and advanced analytical tools suited for both beginners and professionals. As one of the most reliable MT5 prop firms, FundedFirm emphasizes skill, discipline, and consistency, rewarding traders based on performance rather than capital investment. Through a fair evaluation process, traders can qualify for funded accounts and scale their capital as they demonstrate profitability and risk management. Once funded, traders enjoy instant payouts, flexible trading conditions, and complete control of their strategies across forex, indices, commodities, and cryptocurrencies. FundedFirm also invests heavily in trader development, offering mentorship programs, detailed performance analytics, and educational resources that strengthen decision-making and long-term growth. Built on transparency, technology, and trust, FundedFirm creates a fair and empowering environment for traders to excel. Among the best MT5 prop firms globally, FundedFirm continues to redefine proprietary trading by transforming trading talent into stable, rewarding, and sustainable financial independence for serious traders worldwide.

Post a Comment