New to using Oracle and SQL Developer. I am trying to subtract a maximum date from today and adding back 1 to get a field named daysSinceLastActivity....
Syntax I am trying is (date()-max(activity_date))+1 as daysSinceLastActivity
I keep getting a error message of missing expression. After googling, I am not finding anything. This should be a simple calculation.
I want to substract two dates to get the age of a person. One of the date is sysdate and the other is date of birth. Assuming we remove the time part of the date.
im trying to take a query that pulls all the info in the current tables, and narrow it down to one day plus current. here is the error i am getting.
(SELECT OH.ORD_CNTRL_NO, OH.ORD_NO, OH.ASSGN_SHIP_DATE, oh.account_no, sum(OL.ORD_QTY) AS ORD_QTY * ERROR at line 5: ORA-00936: missing expression
old query:
select a.assign_no, a.assign_type, a.act_end, X.ord_no, x.account_no, X.ASSGN_SHIP_DATE, X.ORD_QTY, td.from_loc, sum(td.act_qty) AS ACTQTY, sum(td.exp_qty) AS EXPQTY from clsd_assign a, clsd_task t, clsd_task_detail td, sku s, (SELECT OH.ORD_CNTRL_NO, OH.ORD_NO, OH.ASSGN_SHIP_DATE, oh.account_no, sum(OL.ORD_QTY) AS ORD_QTY
[code]...
new query
select a.assign_no, a.assign_type, TRUNC(A.ACT_END), to_char(a.act_end), X.ord_no, x.account_no, X.ASSGN_SHIP_DATE, X.ORD_QTY, td.from_loc, sum(td.act_qty) AS ACTQTY, sum(td.exp_qty) AS EXPQTY from clsd_assign a, clsd_task t, clsd_task_detail td, sku s where a.act_end between to_char(sysdate -1, 'dd-mon-yyyy') and to_char(sysdate, 'dd-mon-yyyy')
I ran into a problem recently which has to do with the following query:
SELECT '' || ROUND(GEOGR_LAENGE,5) || ',' || ROUND(GEOGR_BREITE,5) || '," [BUE] ' || BAUFORM_GRUPPE || '"', KM AS TEXT FROM MYTABLEA mmtable WHERE (mmtable.GEOGR_LAENGE IS NOT NULL AND mmtable.GEOGR_BREITE IS NOT NULL AND mmtable.STRECKE_NR IN (
[code].....
The problem is, that Oracle alerts a missing expression at line 4, and highlights the "IS NOT NULL". Personally I don't see that anything is wrong with this line. I think the problems source is somewhere else but I cannot find it.
I'll give you a little bit of background to the script:
What I am trying to achieve is to request the values in the first line with the following conditions:
- mmtable.GEOGR_LAENGE, GEOGR_BREITE must not be empty - rbtable.STRECKE_NR for the requested line (which is similar to mmtable.STRECKE_NR) must have "MITTE" as a value for NL_NAME - mmtable.KM => rbtable.VON_KM - mmtable.KM <= rbtable.BIS_KM
I'm working on Oracle SQL Developer: ODMiner. I keep getting a syntax error with the following code,
CREATE TABLE FINAL_WEBLOG AS select SESSION_DT, C_IP, CS_USER_AGENT, LISTAGG(WEB_LINK, ' ') WITHIN GROUP (ORDER BY C_IP, CS_USER_AGENT) "WEB_LINKS", FROM WEBLOG_VIEWS GROUP BY C_IP, CS_USER_AGENT, SESSION_DT ORDER BY SESSION_DT
I understand if it's the semicolon that is missing after "FROM WEBLOG_VIEWS", but I'm not sure on how I can rephrase it.
I am getting the ORA-00936: missing expression error while running the below stated query. Problem is that it is running and fetching the data successfully for the first 5 runs. But from the 6th run it is not fetching the data and throwing the ORA-00936: missing expression error. consider I am passing parameters to the query and for the first 5 values i pass its runnign fine. when i run the query for the 6th time or more with different parameter, its throwing the error. it does not seems to be the data issue because when i pass the 6th parameter for the first run on the next day, it is fetching data.
(SELECT ABC.POST_SMRY_CORR_I,NVL(ABC.CORR_TYPE_C,' ') AS CORR_TYPE_C,NVL(ABC.ENTR_DOC_I,' ') AS ENTR_DOC_I, ABC.EST_LIQN_D, '' AS EVNT_TYPE_C, ABC.CORR_STAT_C FROM POST_SMRY_CORR ABC,POST_ENTR_DISCP PSCWQ,ENTR_DOC ED WHERE ABC.POST_SMRY_CORR_I = PSCWQ.POST_ENTR_DOC_I and ED.ENTR_DOC_I = '123'AND ABC.ENTR_DOC_I=ED.ENTR_DOC_I AND ED.ENTR_TYPE_C != 11 AND POST_ENTR_TYPE_C='PSC' AND DISCP_STAT_C !='CL' AND ABC.CORR_STAT_C !='CLS' [code]....
I have the following statement dynamic sql statement in a database package.
begin EXECUTE IMMEDIATE 'SELECT REPLACE(SUBSTR('||V_WHERE_CLAUSE||',1,3, ''AND'', NULL) INTO V_WHERE_FILTER FROM DUAL'; EXCEPTION NULL; end;
When executed it gives following error.
ORA-20000: ORA-20000: ORA-00936: missing expression ### TRACE ### ORA-06512: at "NDSS.DUP_SRCH_PKG_MOD", line 931 ### END TRACE ### ### TRACE ### ORA-06512: at "NDSS.DUP_SRCH_PKG_MOD", line 935 ORA-06512: at "NDSS.DUP_SRCH_PKG_MOD", line 164 ### END TRACE ### ORA-06512: at "NDSS.DUP_SRCH_PKG_MOD", line 184 ORA-06512: at line 9
MISSING_DATES EMPNO ---------------------- ---------- 09-SEP-12 TO 11-SEP-12 7499 23-SEP-12 TO 26-SEP-12 7499 01-sep-12 TO 30-SEP-12 7521 01-sep-12 TO 30-SEP-12 7788
I am trying to write a trigger to reduce 1 day from 4 date fields of a table (order)
table name = order fields = date_1, date_2, date_11, date_12 and dest_id
for example: the trigger will verify if orders that are dropping is for a specific customer (dest_id). if yes, the trigger will subtract one day from these date fields (by updating them); if no, (the dest_id is not for this customer) the trigger will not update anything in the DB.
procedure p1 ( i_time_min number -- minutes to be substracted from timestamp ) is v_end_timeinstamp timestamp(6); begin
[code]....
The problem with above procedure is passing parameter is in minutes and i need to substract the same from sys_extract_utc(current_timestamp) and store result in v_end_timeinstamp in timestamp format only... substracting directly will reduce the days and not the minutes.
SELECT EMP_CODE, TO_DATE(INTIME,'DD/MM/RR')IN_DATE, MIN(TO_CHAR(INTIME,'HH24:MI')) TIME_IN, MAX(TO_CHAR(OUTTIME,'HH24:MI')) TIME_OUT --MAX(TO_CHAR(OUTTIME,'HH24:MI')) - MIN(TO_CHAR(INTIME,'HH24:MI')) FROM HCM.einout WHERE EMP_CODE ='470' AND INTIME >= '01-APR-12' AND INTIME <= '15-APR-12' GROUP BY EMP_CODE, TO_DATE(INTIME,'DD/MM/RR') ORDER BY 2 ASC [code]....
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
how to subract the timestamp values.
SELECT TO_TIMESTAMP ('10-Sep-02 14:10:10.123000', 'DD-Mon-RR HH24:MI:SS.FF') FROM DUAL;
I want to find the dates which have a date plus with in 2 days after this date. I mean group by 3 days each even the date i missing between two days. Actualy I want to find the start date where the employ was missing on job.
Basic concept is employes have allowed to use 10 personal leaves of a year. Each leave can be use for maximum 3 days.
If employ did not come on the job for one day or two days or three days, it shoul be count as ONE personal leave. And If employ is missing at job for four or five days, it should be count as 2 personal leaves.
After finding these days I want to select the starting date of 5th personal leave. (which is 16.01.10).
I am not a expert of using SQL, but I think it could be possible with using partitioning a table on the givin reslult and further partition the reslut on rownum() as rn and the using case statement where rn = 5.
Split a date into new dates according to black out dates!
Here is my tables:
CREATE TABLE travel ( start_date, end_date ) AS SELECT DATE '0000-01-01', DATE '9999-12-31' FROM DUAL;
[code]....
I have lets say a "travel date" and black out dates. I will split the travel date into pieces according to the black out dates.
Note: Travel Date can be between 0000-01-01 - 9999 12 31
Sample:
Travel Date:
Travel | START DATE | END DATE T | 2011 01 04 | 2011 12 11
Black Out Dates:
BO | START DATE | END DATE A | 2010 11 01 | 2011 02 11 B | 2011 01 20 | 2011 02 15 C | 2011 03 13 | 2011 04 10 D | 2011 03 20 | 2011 06 29
Excepted Result:
New Travel | START DATE | END DATE X1 | 2011 02 16 | 2011 03 12 X2 | 2011 06 30 | 2011 12 11
Visually:
Travel Date : -----[--------------------------]--
A : --[------]------------------------- B : ------[---]------------------------ C : --------------[---]---------------- D : ----------------[------]-----------
Travel Date : -[--------------------------------]--
BO Date A : ----[------]------------------------- BO Date B : -------------------------[---]------- BO Date C : ----------------[---]---------------- BO Date D : ------------------[------]-----------
Result X1 : -[-]------------------------------- Result X2 : -----------[--]-------------------- Result X3 : -----------------------------[--]--
I want to convert numbers into hours and minutes.I have two numbers say like first number is 1234 and second number is 1235.4 now i want to find the different between these two numbers. so am subtracting number 2 - number 1
1235.4 - 1234 i will get 1.4 so the result of this 1.4 to be converted as hours and minutes like 1 hr and 40 minutes. How can i convert numbers in hrs and minutes.
i'm getting ORA-04091: error when using a trigger to subtract ncopies values of table (rental ; after i insert a NEW record in it ) from cno value of table (copies) to give me the remaining no of copies of a book .
How can I select all of the dates between two dates? For example, given the start date 12/2/2003 and the end date 12/5/2003 I want to return:
12/2/2003 12/3/2003 12/4/2003 12/5/2003
Is there a built in function for this? Is there a way for a function to return multiple rows? It has to be a function because I need to use it within other SQL statements.
->Col1 with experience in years entered as an integer ->Col2 with current date
I need to add another column as a date value adn for that i need to subtract Currentdate-Col1 when i tried currentdate-Col1 it just subtracted the days i need the formula to subtract years and give a date
I have worked in DB2 and all u need to do there was add the keyword years at the end but in oracle the same does not work
when i am running the below plsql block i am getting the error like not a group by expressiong.
DECLARE CURSOR Cur_st IS SELECT DISTINCT CAST (A.STO_NO AS VARCHAR2 (5 CHAR)) AS BU_CODE, CAST ('STO' AS VARCHAR2 (3 CHAR)) AS BU_TYPE, CAST (NULL AS VARCHAR2 (7 BYTE)) AS CUST_NO, CAST (A.CUR_CODE AS VARCHAR2 (3 BYTE)) AS CUR_CODE, TO_DATE (A.SALES_DATE, 'YYMMDD'), CAST (A.RECEIPT_NO AS VARCHAR2 (10 BYTE)), [code]....
I'm working with Object types containing other object types, and I'm getting the error PLS-00363 (Expression cannot be used as an assignment).I'm putting exlpicity all 'SELF' parameters as 'IN OUT', but still get the error...
CREATE OR REPLACE TYPE TYP_PERSON AS OBJECT ( strName VARCHAR2(100), -- CONSTRUCTOR FUNCTION TYP_PERSON RETURN SELF AS RESULT, -- MEMBER FUNCTION getName (SELF IN OUT TYP_PERSON) RETURN VARCHAR2, MEMBER PROCEDURE setName (SELF IN OUT TYP_PERSON, pNewName VARCHAR2) ) NOT FINAL; [code]....
How can I do this parentObject.getChildObject().setChildFunction()?