Skip to Content
Oracle PL/SQL Programming: A Developer's Workbook
book

Oracle PL/SQL Programming: A Developer's Workbook

by Steven Feuerstein, Andrew Odewahn
May 2000
Intermediate to advanced
594 pages
11h 32m
English
O'Reilly Media, Inc.
Content preview from Oracle PL/SQL Programming: A Developer's Workbook

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Oracle Database 12c PL/SQL Advanced Programming Techniques

Oracle Database 12c PL/SQL Advanced Programming Techniques

Michael McLaughlin, John Harper

Publisher Resources

ISBN: 9781449324070Errata Page