Expert
18-41. | Write a function that left-pads the integer component and right-pads the decimal component of a string containing a number in a balanced way to return a string of a specified length and the decimal point (if it is present) located at the center position. For example, the string “23091958.47” with a specified length of 30 is changed to: -- ruler 123456789012345678901234567890 00000023091958.470000000000000 Here is the skeleton specification of the function: CREATE OR REPLACE FUNCTION center_number ( p_num_to_center VARCHAR2, p_total_length INT := 30 ) RETURN VARCHAR2 IS v_ret_val VARCHAR2(2000); -- return value BEGIN RETURN(v_ret_val); END; |
18-42. | Write a function called betwnstr that returns the portion of a string that lies between specified start and end locations in the string, where (1) both start and end locations can be negative and (2) end can be less than start. |
18-43. | Write a function called betwnstr that returns the portion of a string that lies between specified start and end substrings, as in: FUNCTION betwnstr ( str IN VARCHAR2, start_str IN VARCHAR2, end_str IN VARCHAR2 := NULL) RETURN VARCHAR2; If end_str is NULL, return everything starting from the start_str’s location. |
18-44. | Write a function to trim patterns, not individual characters, from the beginning of a string. |
18-45. | Write a function that returns the location of the specified letter in a string that is closest to another specified letter, as in: FUNCTION closest_loc (str IN VARCHAR2, findit IN VARCHAR, closeto ... |
Get Oracle PL/SQL Programming: A Developer's Workbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.