Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 576 Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 576 Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 576 Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 576 Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 593 Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 687 Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 687 Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 687 Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 687 Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/pramod/public_html/blog/wp-includes/classes.php on line 710 Strict Standards: Redefining already defined constructor for class wpdb in /home/pramod/public_html/blog/wp-includes/wp-db.php on line 58 Deprecated: Assigning the return value of new by reference is deprecated in /home/pramod/public_html/blog/wp-includes/cache.php on line 99 Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/pramod/public_html/blog/wp-includes/cache.php on line 404 Deprecated: Assigning the return value of new by reference is deprecated in /home/pramod/public_html/blog/wp-includes/query.php on line 21 Deprecated: Assigning the return value of new by reference is deprecated in /home/pramod/public_html/blog/wp-includes/theme.php on line 576 Pramod Poudel’s Blog » Blog Archive » Explode function for pl/sql and hour changeing to minutes

Explode function for pl/sql and hour changeing to minutes

May 30th, 2010 | by admin |

First create the type with following query.

CREATE OR REPLACE
TYPE listtable AS TABLE OF VARCHAR2 (255);
/

This is the function to explode the string.
For example we have 4:45
‘:’ is p_seperator and 4:45 is p_string and result of this function will be 285.

CREATE OR REPLACE FUNCTION explode (p_seperator IN VARCHAR2, p_string IN VARCHAR2)
RETURN listtable AS
l_string LONG DEFAULT p_string || p_seperator;
l_data listtable := listtable ();
n NUMBER;
v_min varchar2(10);
v_1 VARCHAR2(10);
BEGIN
LOOP
EXIT WHEN l_string IS NULL;
n := INSTR (l_string, p_seperator);
l_data.EXTEND;
v_1:=LTRIM (RTRIM (SUBSTR (l_string, 1, n - 1)));
----------
l_data (l_data.COUNT) := v_1;
---------
l_string := SUBSTR (l_string, n + 1);
END LOOP;
-- v_min:=l_data(1)*60+l_data(2);
RETURN l_data;
END;

Post a Comment