{"action":"created","issue":{"url":"https://api.github.com/repos/OraOpenSource/oos-utils/issues/53","repository_url":"https://api.github.com/repos/OraOpenSource/oos-utils","labels_url":"https://api.github.com/repos/OraOpenSource/oos-utils/issues/53/labels{/name}","comments_url":"https://api.github.com/repos/OraOpenSource/oos-utils/issues/53/comments","events_url":"https://api.github.com/repos/OraOpenSource/oos-utils/issues/53/events","html_url":"https://github.com/OraOpenSource/oos-utils/issues/53","id":139480700,"number":53,"title":"Get number ordinal","user":{"login":"tschf","id":1747643,"avatar_url":"https://avatars.githubusercontent.com/u/1747643?v=3","gravatar_id":"","url":"https://api.github.com/users/tschf","html_url":"https://github.com/tschf","followers_url":"https://api.github.com/users/tschf/followers","following_url":"https://api.github.com/users/tschf/following{/other_user}","gists_url":"https://api.github.com/users/tschf/gists{/gist_id}","starred_url":"https://api.github.com/users/tschf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschf/subscriptions","organizations_url":"https://api.github.com/users/tschf/orgs","repos_url":"https://api.github.com/users/tschf/repos","events_url":"https://api.github.com/users/tschf/events{/privacy}","received_events_url":"https://api.github.com/users/tschf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/OraOpenSource/oos-utils/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"martindsouza","id":2925726,"avatar_url":"https://avatars.githubusercontent.com/u/2925726?v=3","gravatar_id":"","url":"https://api.github.com/users/martindsouza","html_url":"https://github.com/martindsouza","followers_url":"https://api.github.com/users/martindsouza/followers","following_url":"https://api.github.com/users/martindsouza/following{/other_user}","gists_url":"https://api.github.com/users/martindsouza/gists{/gist_id}","starred_url":"https://api.github.com/users/martindsouza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martindsouza/subscriptions","organizations_url":"https://api.github.com/users/martindsouza/orgs","repos_url":"https://api.github.com/users/martindsouza/repos","events_url":"https://api.github.com/users/martindsouza/events{/privacy}","received_events_url":"https://api.github.com/users/martindsouza/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/OraOpenSource/oos-utils/milestones/2","html_url":"https://github.com/OraOpenSource/oos-utils/milestones/Future","labels_url":"https://api.github.com/repos/OraOpenSource/oos-utils/milestones/2/labels","id":1477401,"number":2,"title":"Future","description":"","creator":{"login":"martindsouza","id":2925726,"avatar_url":"https://avatars.githubusercontent.com/u/2925726?v=3","gravatar_id":"","url":"https://api.github.com/users/martindsouza","html_url":"https://github.com/martindsouza","followers_url":"https://api.github.com/users/martindsouza/followers","following_url":"https://api.github.com/users/martindsouza/following{/other_user}","gists_url":"https://api.github.com/users/martindsouza/gists{/gist_id}","starred_url":"https://api.github.com/users/martindsouza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martindsouza/subscriptions","organizations_url":"https://api.github.com/users/martindsouza/orgs","repos_url":"https://api.github.com/users/martindsouza/repos","events_url":"https://api.github.com/users/martindsouza/events{/privacy}","received_events_url":"https://api.github.com/users/martindsouza/received_events","type":"User","site_admin":false},"open_issues":12,"closed_issues":0,"state":"open","created_at":"2015-12-29T19:31:09Z","updated_at":"2016-04-05T04:12:52Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2016-03-09T05:36:13Z","updated_at":"2016-04-05T06:59:02Z","closed_at":null,"body":"Not sure if this is all that common - and I don't believe the to_char format model offers it other than in a date. But still useful. Logic taken from: http://stackoverflow.com/a/13627586/3476713\r\n\r\n```plsql\r\nset serveroutput on\r\n\r\ndeclare\r\n    \r\n    function ord(p_num in number)\r\n    return varchar2\r\n    as\r\n        l_mod10 NUMBER;\r\n        l_mod100 NUMBER;\r\n    begin\r\n        l_mod10 := mod(p_num, 10);\r\n        l_mod100 := mod(p_num, 100);\r\n    \r\n        if l_mod10 = 1 and l_mod100 != 11\r\n        then\r\n            return 'st';\r\n        elsif l_mod10 = 2 and l_mod100 != 12\r\n        then\r\n            return 'nd';\r\n        elsif l_mod10 = 3 and l_mod100 != 13\r\n        then\r\n            return 'rd';\r\n        else\r\n            return 'th';\r\n        end if;    \r\n    \r\n    \r\n    end ord;\r\n    \r\n    \r\nbegin\r\n\r\n    for i in 1..50\r\n    loop\r\n        dbms_output.put_line(i || ord(i));\r\n    end loop;\r\n\r\nend;\r\n/\r\n```\r\n\r\nOutput:\r\n\r\n>1st\r\n2nd\r\n3rd\r\n4th\r\n5th\r\n6th\r\n7th\r\n8th\r\n9th\r\n10th\r\n11th\r\n12th\r\n13th\r\n14th\r\n15th\r\n16th\r\n17th\r\n18th\r\n19th\r\n20th\r\n21st\r\n22nd\r\n23rd\r\n24th\r\n25th\r\n26th\r\n27th\r\n28th\r\n29th\r\n30th\r\n31st\r\n32nd\r\n33rd\r\n34th\r\n35th\r\n36th\r\n37th\r\n38th\r\n39th\r\n40th\r\n41st\r\n42nd\r\n43rd\r\n44th\r\n45th\r\n46th\r\n47th\r\n48th\r\n49th\r\n50th\r\n"},"comment":{"url":"https://api.github.com/repos/OraOpenSource/oos-utils/issues/comments/205684967","html_url":"https://github.com/OraOpenSource/oos-utils/issues/53#issuecomment-205684967","issue_url":"https://api.github.com/repos/OraOpenSource/oos-utils/issues/53","id":205684967,"user":{"login":"tschf","id":1747643,"avatar_url":"https://avatars.githubusercontent.com/u/1747643?v=3","gravatar_id":"","url":"https://api.github.com/users/tschf","html_url":"https://github.com/tschf","followers_url":"https://api.github.com/users/tschf/followers","following_url":"https://api.github.com/users/tschf/following{/other_user}","gists_url":"https://api.github.com/users/tschf/gists{/gist_id}","starred_url":"https://api.github.com/users/tschf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschf/subscriptions","organizations_url":"https://api.github.com/users/tschf/orgs","repos_url":"https://api.github.com/users/tschf/repos","events_url":"https://api.github.com/users/tschf/events{/privacy}","received_events_url":"https://api.github.com/users/tschf/received_events","type":"User","site_admin":false},"created_at":"2016-04-05T06:59:02Z","updated_at":"2016-04-05T06:59:02Z","body":"String package makes enough sense. \r\n\r\nI called my function `num_ordinal` recently. I think it'd be good to have `num` or similar in the function name so you know it's specifically for a number.\r\n\r\n`get_num_ordinal` would be good; or maybe even better would be `get_ordinal_num` and return the number with the ordinal indicator. (1st, 2nd). The example method above only returns the ordinal indicator, which is probably not much use without the number. "}}