plsqldeveloper

how to convert a string date to date format in oracle10g

寵の児 提交于 2019-11-29 00:28:33
问题 My date value is stored as varchar2 and the value is 15/August/2009,4:30 PM , how to convert this to a proper date format like DD-MM-YYYY . 回答1: You can convert a string to a DATE using the TO_DATE function, then reformat the date as another string using TO_CHAR, i.e.: SELECT TO_CHAR( TO_DATE('15/August/2009,4:30 PM' ,'DD/Month/YYYY,HH:MI AM') ,'DD-MM-YYYY') FROM DUAL; 15-08-2009 For example, if your table name is MYTABLE and the varchar2 column is MYDATESTRING: SELECT TO_CHAR( TO_DATE

Setting a value for LIMIT while using bulk collect

a 夏天 提交于 2019-11-28 10:36:16
I wanted to know if we have any technique by which we can calculate the value which needed to be set for a LIMIT clause of bulk collect operation. For example below, lets say our cursor has 10 Million records..What is the value which we can set for LIMIT clause to have optimum performance. Is there any way we can calculate it. decalre cursor c_emp is <some select query> var <variable> ; begin open c_emp; loop fetch c_emp bulk collect into var limit 2; exit when c_emp%NOTFOUND; end loop; close c_emp; end; Use an implicit cursor in a cursor FOR LOOP. It makes the code simpler and the default

Date query ran in PL/SQL Developer shows time, but does not show in Oracle SQL Developer

試著忘記壹切 提交于 2019-11-28 10:29:43
问题 The same query ran in PL/SQL Developer shows time, however it does not show in Oracle SQL Developer. Is there a way to get the time in SQL Developer? In SQL Developer: In PL/SQL: This is the details of the date field: 回答1: You can change this in the Tools / Preferences dialog of SQL developer: Select Database / NLS Parameters in the tree view on the left. Then put dd/mm/yyyy hh24:mi:ss into the Date Format field. Press OK to close the dialog. 回答2: To make it simple: use to_char() function, it

Oracle Convert Seconds to Hours:Minutes:Seconds

半腔热情 提交于 2019-11-28 05:31:55
I have a requirement to display user available time in Hours:Minutes:Seconds format from a given total number of seconds value. Appreciate if you know a ORACLE function to do the same. I'm using Oracle. Thank you for your time. If you're just looking to convert a given number of seconds into HH:MI:SS format, this should do it SELECT TO_CHAR(TRUNC(x/3600),'FM9900') || ':' || TO_CHAR(TRUNC(MOD(x,3600)/60),'FM00') || ':' || TO_CHAR(MOD(x,60),'FM00') FROM DUAL where x is the number of seconds. Try this one. Very simple and easy to use select to_char(to_date(10000,'sssss'),'hh24:mi:ss') from dual;

Oracle PL/SQL get server's IP v4?

余生颓废 提交于 2019-11-28 04:46:58
问题 How can I get the IP v4 Of the server by using PL/SQL ? UTL_INADDR.GET_HOST_ADDRESS gives me IPv6, while I need IPv4 what I did I disabled the IPv6 on the sever, still it's bringing me the the IPv6 of the "Tunnel adapter Teredo Tunneling Pseudo-Interface" !! I'm using Oracle 11g database on Windows 2008 R2 Server 回答1: UTL_INADDR.GET_HOST_ADDRESS returns just an ip which is nonsense since a server may have dozens of them. Probably your best bet it's to create a pl/sql wrapper of a Java method

How to find dependencies inside an oracle package?

喜你入骨 提交于 2019-11-28 01:59:59
问题 My question is how to find inside oracle package dependencies by SQL query or any other internal/external tool. Is it even possible or should I just go trough the code and find out myself? Example case: I have a package which contains 4 procedures A , B , C , D and 1 function F . A is the 'main' procedure which runs B and C procedures. Function F is used by B and C procedures. Procedure D is independent (used elswhere). Now I'd like to obtain something like this as a result: STATUS PRC/FNC

How to test an Oracle Stored Procedure with RefCursor return type?

僤鯓⒐⒋嵵緔 提交于 2019-11-27 11:34:00
I'm looking for a good explanation on how to test an Oracle stored procedure in SQL Developer or Embarcardero Rapid XE2. Thank you. Something like create or replace procedure my_proc( p_rc OUT SYS_REFCURSOR ) as begin open p_rc for select 1 col1 from dual; end; / variable rc refcursor; exec my_proc( :rc ); print rc; will work in SQL*Plus or SQL Developer. I don't have any experience with Embarcardero Rapid XE2 so I have no idea whether it supports SQL*Plus commands like this. DCookie Something like this lets you test your procedure on almost any client: DECLARE v_cur SYS_REFCURSOR; v_a

Reading clob line by line with pl\\sql

萝らか妹 提交于 2019-11-27 09:48:48
In my project i use oracle as primary database and i've faced a problem with parsing clob. So suppose we have a clob with value aaaaaa cccccc bbbbbb And it's stored in table test ... I need to write plsql procedure to get this clob and split it so that i will have array with three items [aaaaaa,cccccccc,bbbbbbb]. Is there any possible solutions? Pierre-Gilles Levallois Here is a piece of code that works. I suggest that you use explicit cursors instead of implicit ones (FOR i IN (select...)), for performance purpose. First here is the script to create testcase. create table test (c clob);

oracle PL/SQL how to calculate range ip for IPv6 cidr

北城余情 提交于 2019-11-27 07:32:38
问题 ex.IPv6 address with CIDR: 2620:0:2d0:200::7/32 out put Start Range: 2620:0:0:0:0:0:0:0 End Range: 2620:0:ffff:ffff:ffff:ffff:ffff:ffff how to calculate with PL/SQL ? 回答1: Once I wrote a general PL/SQL Package where you can do such conversions. It works for both, IPv4 and IPv6. CREATE OR REPLACE PACKAGE IP_Util AS /** * Convert an IP-Address into decimal value. * @param IP The IP-Address, e.g. '10.151.20.224' or '1080::8:800:200C:417A'. * Supports also mixed notation like '0:0:0:0:0:FFFF:129

Reading clob line by line with pl\sql

可紊 提交于 2019-11-27 04:02:43
问题 In my project i use oracle as primary database and i've faced a problem with parsing clob. So suppose we have a clob with value aaaaaa cccccc bbbbbb And it's stored in table test ... I need to write plsql procedure to get this clob and split it so that i will have array with three items [aaaaaa,cccccccc,bbbbbbb]. Is there any possible solutions? 回答1: Here is a piece of code that works. I suggest that you use explicit cursors instead of implicit ones (FOR i IN (select...)), for performance