error to the oracle function?
Hello:Parameter of the week # of months in function to_char failed when I try to get the week # 14/01/2008. I use "select to_number (to_char (to_date ('01-14-2008', ' dd/mm/yyyy'), 'W')) from dual;" and I get 2 instead of 3
Any idea? ...
I am running oracle 8i database
Any help would be much appreciated.
Thank you
Maybe you are looking for this?
SQL> ed
Wrote file afiedt.buf
1 with t as (select to_date('01/01/2008','DD/MM/YYYY') + (rownum-1) as dt from dual connect by rownum <= 80)
2 -- end of test data
3 select dt
4 ,to_char(dt,'D') as day_num
5 ,to_char(dt,'DAY') as day_of_week
6 ,trunc(to_char(dt,'DD')/7)+1 as week
7* from t
SQL> /
DT D DAY_OF_WE WEEK
----------- - --------- ----------
01-JAN-2008 2 TUESDAY 1
02-JAN-2008 3 WEDNESDAY 1
03-JAN-2008 4 THURSDAY 1
04-JAN-2008 5 FRIDAY 1
05-JAN-2008 6 SATURDAY 1
06-JAN-2008 7 SUNDAY 1
07-JAN-2008 1 MONDAY 2
08-JAN-2008 2 TUESDAY 2
09-JAN-2008 3 WEDNESDAY 2
10-JAN-2008 4 THURSDAY 2
11-JAN-2008 5 FRIDAY 2
12-JAN-2008 6 SATURDAY 2
13-JAN-2008 7 SUNDAY 2
14-JAN-2008 1 MONDAY 3
15-JAN-2008 2 TUESDAY 3
16-JAN-2008 3 WEDNESDAY 3
17-JAN-2008 4 THURSDAY 3
18-JAN-2008 5 FRIDAY 3
19-JAN-2008 6 SATURDAY 3
20-JAN-2008 7 SUNDAY 3
21-JAN-2008 1 MONDAY 4
22-JAN-2008 2 TUESDAY 4
23-JAN-2008 3 WEDNESDAY 4
24-JAN-2008 4 THURSDAY 4
25-JAN-2008 5 FRIDAY 4
26-JAN-2008 6 SATURDAY 4
27-JAN-2008 7 SUNDAY 4
28-JAN-2008 1 MONDAY 5
29-JAN-2008 2 TUESDAY 5
30-JAN-2008 3 WEDNESDAY 5
31-JAN-2008 4 THURSDAY 5
01-FEB-2008 5 FRIDAY 1
02-FEB-2008 6 SATURDAY 1
03-FEB-2008 7 SUNDAY 1
04-FEB-2008 1 MONDAY 1
05-FEB-2008 2 TUESDAY 1
06-FEB-2008 3 WEDNESDAY 1
07-FEB-2008 4 THURSDAY 2
08-FEB-2008 5 FRIDAY 2
09-FEB-2008 6 SATURDAY 2
10-FEB-2008 7 SUNDAY 2
11-FEB-2008 1 MONDAY 2
12-FEB-2008 2 TUESDAY 2
13-FEB-2008 3 WEDNESDAY 2
14-FEB-2008 4 THURSDAY 3
15-FEB-2008 5 FRIDAY 3
16-FEB-2008 6 SATURDAY 3
17-FEB-2008 7 SUNDAY 3
18-FEB-2008 1 MONDAY 3
19-FEB-2008 2 TUESDAY 3
20-FEB-2008 3 WEDNESDAY 3
21-FEB-2008 4 THURSDAY 4
22-FEB-2008 5 FRIDAY 4
23-FEB-2008 6 SATURDAY 4
24-FEB-2008 7 SUNDAY 4
25-FEB-2008 1 MONDAY 4
26-FEB-2008 2 TUESDAY 4
27-FEB-2008 3 WEDNESDAY 4
28-FEB-2008 4 THURSDAY 5
29-FEB-2008 5 FRIDAY 5
01-MAR-2008 6 SATURDAY 1
02-MAR-2008 7 SUNDAY 1
03-MAR-2008 1 MONDAY 1
04-MAR-2008 2 TUESDAY 1
05-MAR-2008 3 WEDNESDAY 1
06-MAR-2008 4 THURSDAY 1
07-MAR-2008 5 FRIDAY 2
08-MAR-2008 6 SATURDAY 2
09-MAR-2008 7 SUNDAY 2
10-MAR-2008 1 MONDAY 2
11-MAR-2008 2 TUESDAY 2
12-MAR-2008 3 WEDNESDAY 2
13-MAR-2008 4 THURSDAY 2
14-MAR-2008 5 FRIDAY 3
15-MAR-2008 6 SATURDAY 3
16-MAR-2008 7 SUNDAY 3
17-MAR-2008 1 MONDAY 3
18-MAR-2008 2 TUESDAY 3
19-MAR-2008 3 WEDNESDAY 3
20-MAR-2008 4 THURSDAY 3
80 rows selected.
SQL>
Tags: Database
Similar Questions
-
Since the update, one of my sites is weird. When you open the Web, that's what he said, "JavaScript exception: error calling the selection function: TypeError: $(...).» museMenu is not a function ". The site is www.hibiscuscuisine.com. If someone could help me understand this point, I would really appreciate it. Thank you
Hello
Please follow the complete instructions mentioned in this post - MuseJSAssert: error calling the function switch: TypeError: .museMenu $(elem) is not a function by Zak.
Let me know if it works
Thank you
Ankush
-
HTTP: Error 58 (the network function is not supported by the system)
Hi all
I have a problem with HTTP Client in LV 2011 functions.
As you can see in the screenshot attached, I try just:
-Open a handle-> no errors
-Send a web request using the GET method-> error 58
-close the handle
The problem is that a 58 error: "the network function is not supported by the system. However, it works fine when I type the same URL in a web browser.
You have any idea of what could be the problem? Thank you in advance for your help!
J.
I have fixed the bug: there was a white at the beginning of the URL... (!!!). I deleted the empty character and now it's OK.
-
Error in the search function in the support forums
Therefore, it is possible to search the forums for specific keywords. I usually use the search function a lot. Nov tt looks like it looking that people and not the forums.
I don't know where to report this error that's why he is here.
Kirstine
Kirstine,
I found the questions like that too when I put in the word "encrypt", but he found nothing.
I did click the "more Options" link, and then set it when the 'All' option - this seems to bring back search results, I needed.
Post edited by: iamthewalrus@adobe
-
You must return the value of the Oracle function in VB Code
Hi all
I have the oracle APPTIDFUN (WHO RETURN NUMBER) function, I need to call in the VB Code. (Here's the code)
--------------------------------
If Msg2 = 6 Then
Dim RS As New ADODB. Recordset
Dim SQL As String
RS. Open "appointments", CN, adOpenDynamic, adLockPessimistic
RS. Find ' patient_id = ' "& str1 &" "'". "
If RS. When the EOF
RS. Find ' Appt_start_Date = ' "& str3 &" "'". "
If RS. When the EOF
RS. AddNew
RS ("patient_id") = str1
RS ("Appt_type") = str2
RS ("Appt_start_Date") = str3
RS ("Appt_end_date") = str4
RS ("Num_days") = str5
RS ("Total_Amount") = str6
RS ("Inv_Number") = str7
RS ("Approval_status") = str8
RS ("NUM_WATCHER") = str9
RS. Update
------------------------------------------------------------
I want to call the function from oracle here that in the above code
RS ("Appt_id") = < value of function >
Please do the needful.Abdul,
You need to change the line
RS("Appt_Id") = RS1
TO
RS("Appt_Id") = RS1(0)
Kind regards
Manu.
If my answer or the answer to another person has been useful or appropriate, please mark accordingly
-
Hi all
my site www.theperthcollective.com is this error on the only secure site (https) on the Tickets Page Workshop tickets
With ' some files on the server may be missing or incorrect. Clear the browser cache and try again, if the problem persists please contact the author of the Web site.
Also the Mumblr widget does not work on the secure site.
Can anyone help? IM at my wits end. I've tried everything I can think of and nothing worked. It is hosted with GoDaddy.
Thank you
Hayley
Have you actually checked it in different browsers? with which browser you test? Since it specifically points to MSIE, this could be a fluke due to browser being obsolete...
Mylenium
-
Error in the extension function argument
Hello
Can you please help me to understand the error in the following expression?
<? xdoxslt:IfElse (string-length (CF_MODEL_MESSAGE) > 51, xdoxslt:set_variable($_XDOCTX,'sline_tot',4), xdoxslt:set_variable($_XDOCTX,'sline_tot',3)? >)
TIA,
Alkayou are missing a right paren to close the ifelse
-
Hello
I use the application below to collect
Select account_id_N, collect (connection_id_v) of the My_test_table group by account_id_n;
but its me gives error like below.
ORA-00932: inconsistent data types: expected NUMBER obtained -
00932 00000 - ' incompatible data types: wait %s %s got. "
* Cause:
* Action:
can someone please help me find the error.
Thank you.The document clearly states that you must use CAST with COLLECT.
http://docs.Oracle.com/CD/B19306_01/server.102/b14200/functions024.htm#SQLRF06304
something like that.
create type emp_name as table of varchar2(100) / select deptno, cast(collect(ename) as emp_name) enam_list from emp group by deptno /
Note: Collect function has some behavioral differences when used from sqlplus and SQL Developer
COLLECT the bug? -
Error in the oracle database after you set the "Compatible" setting to lower
Hello
Windows 2008 server
Oracle 11.2.0.3.0
I just put changed the parameter system compatible on my database (import to a lower version - 10g) and attempted to restart and my database does not open now.
Pls help, what shape I do now? !
Here's what I've done?
(Given that the mentioned documentation that I have to restart the database for the compatible parameter is taken into account, I did.)
Pls help to fix... its very urgent.SQL> alter system set compatible='10.1.0.0.0' scope=spfile; System altered. SQL> show parameter compatible (still showing same) NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ compatible string 11.2.0.0.0 So, restart! SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup open ORACLE instance started. Total System Global Area 1720328192 bytes Fixed Size 2255904 bytes Variable Size 1174406112 bytes Database Buffers 536870912 bytes Redo Buffers 6795264 bytes ORA-00201: control file version 11.2.0.0.0 incompatible with ORACLE version 10.1.0.0.0 ORA-00202: control file: 'F:\ORACLE11G\ORADATA\GEOOAP\GEOOAP\CONTROL01.CTL' SQL> alter system set compatible='11.2.0.0.0' scope=spfile; alter system set compatible='11.2.0.0.0' scope=spfile * ERROR at line 1: ORA-32012: SPFILE format is inconsistent with value of COMPATIBLE parameter SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. SQL> startup mount; ORACLE instance started. Total System Global Area 1720328192 bytes Fixed Size 2255904 bytes Variable Size 1174406112 bytes Database Buffers 536870912 bytes Redo Buffers 6795264 bytes ORA-00201: control file version 11.2.0.0.0 incompatible with ORACLE version 10.1.0.0.0 ORA-00202: control file: 'F:\ORACLE11G\ORADATA\GEOOAP\GEOOAP\CONTROL01.CTL'
Emmanuel says:
Hello
Windows 2008 server
Oracle 11.2.0.3.0I just put changed the parameter system compatible on my database (import to a lower version - 10g) & tried to restart and my database does not open now.
Pls help, what shape I do now? !
Here's what I've done?
(Given that the mentioned documentation that I have to restart the database for the compatible parameter is taken into account, I did.)SQL> alter system set compatible='10.1.0.0.0' scope=spfile; System altered. SQL> show parameter compatible (still showing same) NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ compatible string 11.2.0.0.0 So, restart! SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup open ORACLE instance started. Total System Global Area 1720328192 bytes Fixed Size 2255904 bytes Variable Size 1174406112 bytes Database Buffers 536870912 bytes Redo Buffers 6795264 bytes ORA-00201: control file version 11.2.0.0.0 incompatible with ORACLE version 10.1.0.0.0 ORA-00202: control file: 'F:\ORACLE11G\ORADATA\GEOOAP\GEOOAP\CONTROL01.CTL' SQL> alter system set compatible='11.2.0.0.0' scope=spfile; alter system set compatible='11.2.0.0.0' scope=spfile * ERROR at line 1: ORA-32012: SPFILE format is inconsistent with value of COMPATIBLE parameter SQL> shutdown immediate; ORA-01507: database not mounted ORACLE instance shut down. SQL> startup mount; ORACLE instance started. Total System Global Area 1720328192 bytes Fixed Size 2255904 bytes Variable Size 1174406112 bytes Database Buffers 536870912 bytes Redo Buffers 6795264 bytes ORA-00201: control file version 11.2.0.0.0 incompatible with ORACLE version 10.1.0.0.0 ORA-00202: control file: 'F:\ORACLE11G\ORADATA\GEOOAP\GEOOAP\CONTROL01.CTL'
Pls help to fix... its very urgent.
It is a forum for peer volunteers. There is no "urgent" here. For "urgent", you open a sev-1 SR with Oracle's Support.
That said, what I would do at this point is to create a your spfile init.ora file, and then edit this file init.ora to set the compatible parameter to where it should be, create a file the init.ora spfile and restart db.
Assuming your sid is "geooap":
copy spfilegeooap.ora spfilegeooap.save set ORACLE_SID=geooapp sqlplus /nolog create pfile='initgeooap.ora' from spfile; exit notepad initgeooap.ora << fix the parameter sqlplus /nolog create spfile from pfile='initgeooap.ora'; startup
-
error of the oracle database to send alerts log
Hi all
actually I'm wondering about the status of database mail, and is the error produced in the last 24 hours in the critical mission of oracle 10.2.0.1 database every day... I set up SMTP and UTL_MAIL on the server but do not know how to send alert.log error and listener.log in the last 24 hours?
I can handle the other requirements, but it will really be difficult to mail that a few lines and error codes occurred in the last 24 hours in the alert.log file.is there any table in the database that records all error messages written in the alert.log with description?
I have my using RHEL5.2 ACE. so any help will be much appreciated...
Thanks and greetings
VDHello
How can I insert the latest 24 hours of UTL_FILE data? I have that in mind to create the file and send it and there is no parameter "attr_inline" I think it shows mesga ein mail itself...
I do not have you here.
so, how can I insert 24 hours of data in this file?
For this you have to use some OS commands to read the data of alertlog last 24 hours being transferred to the tempfile.
Try to play the file using UTL_FILE and type checking 'ORA' messages and if found none and then concatenates the string to clob variable and you can use it in utl_mail.
I use this code to read the log file of the last until the (300) limit in size. It will return the contents of the logfile from lastline.
UTL_FILE. FSEEK (F1, flength - 300);
I'm in reverse 0... Flength-2
loop
Start
-utl_file.fseek (F1, null,-2);
UTL_FILE.get_line (F1, Err1);
Exp_error: = Exp_error | LRC | Err1;
exception
When no_data_found then
UTL_FILE. FCLOSE (F1);
p_Exp_error: = Exp_error;
"exit";
-output when Err1 is null;
end;
end loop;Kind regards
CGI -
Writing user defined function the same way as the oracle functions
Hi guys,.
In one of the interviews, I saw the guy asked me to write a function defined by the user who will be the column name and the list of all values.
For example
Name: employees table
Column name: Employee_Name
Employee_name
Scott
Ivgun
Jack
Shane
The query must be in this marker
SELECT col_agg (Employee_name) emp_name of employees;
The output must be
Emp_names
Scott, ivgun, jack, shane
Please let me know if this is possible
Any suggestions will be much appreciated.
Thank you
RanjanYou certainly could write what a user defined aggregate function if you wish...
for example this function will consolidate channels in a CLOB...
create or replace type clobagg_type as object ( text clob, static function ODCIAggregateInitialize(sctx in out clobagg_type) return number, member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number, member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number, member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number ); / create or replace type body clobagg_type is static function ODCIAggregateInitialize(sctx in out clobagg_type) return number is begin sctx := clobagg_type(null) ; return ODCIConst.Success ; end; member function ODCIAggregateIterate(self in out clobagg_type, value in clob) return number is begin self.text := self.text || value ; return ODCIConst.Success; end; member function ODCIAggregateTerminate(self in clobagg_type, returnvalue out clob, flags in number) return number is begin returnValue := self.text; return ODCIConst.Success; end; member function ODCIAggregateMerge(self in out clobagg_type, ctx2 in clobagg_type) return number is begin self.text := self.text || ctx2.text; return ODCIConst.Success; end; end; / create or replace function clobagg(input clob) return clob deterministic parallel_enable aggregate using clobagg_type; / SQL> select trim(',' from clobagg(ename||',')) as enames from emp; ENAMES ----------------------------------------------------------------------------------- SMITH,ALLEN,WARD,JONES,MARTIN,BLAKE,CLARK,SCOTT,KING,TURNER,ADAMS,JAMES,FORD,MILLER SQL> ed Wrote file afiedt.buf 1 with t as 2 (select 'PFL' c1, 0 c2,110 c3 from dual union all 3 select 'LHL', 0 ,111 from dual union all 4 select 'PHL', 1, 111 from dual union all 5 select 'CHL', 2, 111 from dual union all 6 select 'DHL', 0, 112 from dual union all 7 select 'VHL', 1, 112 from dual union all 8 select 'CPHL', 0, 114 from dual union all 9 select 'WDCL', 1, 114 from dual union all 10 select 'AHL' ,2 ,114 from dual union all 11 select 'NFDL', 3, 114 from dual) 12 -- 13 -- end of test data 14 -- 15 select trim(clobagg(c1||' ')) as c1, c3 16 from (select * from t order by c3, c2) 17 group by c3 18* order by c3 SQL> / C1 C3 ------------------------------ ---------- PFL 110 LHL CHL PHL 111 DHL VHL 112 CPHL AHL NFDL WDCL 114
OK, it's more that a function it uses a type of object that connects in operation internal to the ODCI... but it does what you ask. :)
-
What is the oracle function should be used?
Hi all
I use oracle 10g.
create the table:
Insert:create table testing ( modalnumber number)
insert into testing values (-144.99) insert into testing values (-44.99) insert into testing values (44.99) insert into testing values (144.99) insert into testing values (449) insert into testing values (3) insert into testing values (-3)
outputselect * from testing;
power required:MODALNUMBER -144.99 -44.99 44.99 144.99 449 3 -3
* the output field should be 14 bytes
* '-' should be at the top if the line contains a negative value
* two digit decimal needed
Thanks in advance-0000000144.99 -0000000044.99 00000000044.99 00000000144.99 00000000449.00 00000000003.00 -0000000003.00
select to_char(modalnumber, '0000000000.00') from testing;
-
Maintain the table of errors in the Oracle database
Hi all
I want to save all the error record in database table of $ odi E,.
Which step to do to achieve this goal.
Thank you very much
NgoyiGood to know you found the solution to what you want. Remember to assign points (useful / Correct) accordingly to the thread before closing, which encouraged the experts to help you more quickly and efficiently. :)
-
Hello...
Can someone help me with this? It happens on a site that just went live, so the customer is very anxious. All is well in Chrome and Safari...
www.realfoodfakefood.com
I contacted Adobe... the problem was caused because a link on the home page was not working. Microsoft Edge didn't like that much. Link fixed, issue went, I'm happy! This can be closed.
-
I'm getting ORA-00904: "ITEM_NUMBER": invalid identifier. Thanks for the help
SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)) item_number,
idescr short_description, idescrl long_description, iunits unit_name,
ispecyr spec_year, iobselet, item,
ROW_NUMBER () OVER (ORDER BY DECODE
(insortexp, 'item_number ASC', item_number) ASC,
DECODE (insortexp, 'short_description DESC', short_description) DESC,
DECODE (insortexp, 'long_description ASC', long_description) ASC,
DECODE (insortexp, 'unit_name DESC', unit_name) DESC,
DECODE (insortexp, 'spec_year ASC', spec_year) ASC,
item_number)
FROM itemlist
so, there is no, but you should look at your alias...
I think that it should work... but I don't have your database
OPEN outitemcur FOR SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5) ) item_number, idescr short_description, idescrl long_description, iunits unit_name, spec_year, iobselet, item FROM (SELECT (SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)) item_number, idescr short_description, idescrl long_description, iunits unit_name, ispecyr spec_year, iobselet, item, ROW_NUMBER () OVER (ORDER BY DECODE (insortexp, 'item_number ASC', item) ASC, DECODE (insortexp, 'short_description DESC', idescr) DESC, DECODE (insortexp, 'long_description ASC', idescrl) ASC, DECODE (insortexp, 'unit_name DESC', iunits) DESC, DECODE (insortexp, 'spec_year ASC', ispecyr) ASC, SUBSTR (item, 1, 4) || '.' || SUBSTR (item, 5)) r FROM itemlist) WHERE r BETWEEN instartrowindex AND inendrowindex;
Maybe you are looking for
-
Computer does not start if the 150 GB Toshiba HARD drive is connected
Hi, I bought an external hard drive of 150 GB PX1220E of pc world a few days ago. When I start my PC it sticks on the splash screen, and I have to unplug the usb cable and restart the pc, then connect the drive again to use it. Is this an error with
-
Impossible to create shortcuts OEM XP Professional
I have rcently installed XP Professional OEM on my wife's computer. I tried to create a shortcut. It does not work. He said usually cannot find the file. Also, I can't copy any Web site on the desktop. Any suggestions?
-
Avast fixes all the problems of spyware and malware?
Original title: Avast Avast fixes all the problems of spyware and malware?
-
Upgrade ram on a computer laptop hp touchsmart 15-r008na
Just bought laptop computer object for my daughter but would like to know if I can upgrade the ram to run faster. Thank you.