I am trying to select from a Query that I created a count of the inmates that were over 17 when they were booked. I am getting the following Oracle Error:
DECLARE
*
ERROR at line 1:
ORA-01839: date not valid for month specified
ORA-06512: at line 18
SELECT COUNT(BOOK_ID) INTO ADULT_MALE
FROM...
Thanks Mufasa and Barb!!! You two are awesome. Here is my final solution. SELECT J.BOOK_ID, A.FEL_MIS_WT, J.BOOKDATE
FROM JMMAIN J, ARMAIN A
WHERE (A.BOOK_ID,DECODE(A.FEL_MIS_WT, 'F',1,'W',2,'M',3)||A.ARRE_ID) IN
(SELECT A.BOOK_ID, MIN(DECODE(A.FEL_MIS_WT...
I am now getting the following error:
MIN(DECODE(R.FEL_MIS_WT,'F',1,'W',2,'M',3)
*
ERROR at line 7:
ORA-00920: invalid relational operator
SELECT J.BOOK_ID, A.FEL_MIS_WT, J.BOOKDATE, A.ARRE_ID
FROM JMMAIN J, ARMAIN A
WHERE (J.BOOK_ID, DECODE(A.FEL_MIS_WT,'F',1,'W',2,'M',3)...
More details in thread1177-1136650
I am getting the following error: ORA-00920: invalid relational operator with this script:
SELECT J.BOOK_ID, A.FEL_MIS_WT, J.BOOKDATE, A.ARRE_ID
FROM JMMAIN J, ARMAIN A
WHERE (J.BOOK_ID,DECODE(A.FEL_MIS_WT, 'F',1,'W',2,'M',3)||J.BOOKDATE,A.ARRE_ID)...
I added the right paren and am still getting the following error: ORA-00920: invalid relational operator.
SELECT J.BOOK_ID, A.FEL_MIS_WT, J.BOOKDATE, A.ARRE_ID
FROM JMMAIN J, ARMAIN A
WHERE (J.BOOK_ID,DECODE(A.FEL_MIS_WT, 'F',1,'W',2,'M',3)||J.BOOKDATE,A.ARRE_ID) IN
(SELECT J.BOOK_ID...
I need to get the two scripts to work as one script. I got it to work with your suggestions with just the ARMAIN table but I need to reference both the JMMAIN and ARMAIN TABLES. I am currently working through it. Currently, I can getting an ORA-00920: invalid relational operator Error. This is...
I am trying to combine the following two working scripts. I do have to reference the Booking Table because I need to filter the data based on the BOOKDATE.
Thanks Again!
SELECT BOOK_ID, FEL_MIS_WT, ARRE_ID FROM ARMAIN
WHERE (BOOK_ID,DECODE(FEL_MIS_WT, 'F',1,'W',2,'M',3)||ARRE_ID) IN
(SELECT...
I am trying to create a query to list only one arrest record per booking.There are two tables JMMAIN (Booking) and ARMAIN (Arrest). The ranking are in the following priority order: F,W,M. If both records are the same, such as BookNum 2 that has two Fs and one M, I want it to display ArrestID 5...
When we book an inmate and fingerprint them they are given one pcn number. Sometimes for instance if we serve a warrant, they are fingerprinted again, and they get another pcn number. they get a pcn number each time they are fingerprinted. Our business rules are, if they have a separate pcn...
UNFORTUNATELY, THERE CAN BE MULTIPLE PCN NUMBERS FOR EACH ARREST RECORD DO TO POLICE POLICE. DARN BUSINESS RULES GET IN THE WAY. THE ARREST CHARGE TABLE IS CALLED ARCHRG AND THE ARREST TABLE IS ARMAIN. I TYPED IT UP WRONG...SORRY ABOUT THAT. ERIN
THIS WORKED PERFECTLY. THANKS AND HAVE A GREAT WEEKEND!
UPDATE ARCHRG A
SET CJI_PCN =
(SELECT MAX(B.CJI_PCN)
FROM ARCHRG B
WHERE A.ARRE_ID = B.ARRE_ID
)
WHERE CJI_PCN = ' ';
FOR AN ARREST RECORD, WE ONLY ENTER THE CJI_PCN FOR THE FIRST RECORD.THIS SCRIPT NEEDS TO POPULATE ALL THE OTHER RECORDS WITH THE SAME ARRE_ID WITH THE CJI_PCN THAT IS POPULATED, IN OTHER WORDS WHERE CJI_PCN IS NULL, POPULATE IT WITH THE CJI_PCN OF THE RECORD THAT HAS THE SAME ARRE_ID.
FOR...
The script ran but there is not any data in the table:
PL/SQL procedure successfully completed.
I still need to calculate my two counts How can I do this without formatting the POP_DATE with and without the timestamp:
-Count Each Day at 8AM: Where 09/07/2001 08:00:00 falls between BOOKDATE AND...
This is what I have so far but I am still getting an error.:
DECLARE
POP_DATE DATE := TO_DATE('09/07/2001 08:00:00', 'MM/DD/YYYY HH24:MI:SS');
AM_CT NUMBER (10);
FULL_CT NUMBER (10);
BEGIN
WHILE POP_DATE < SYSTIMESTAMP
LOOP
/*AM_CT SHOULD DISPLAY THE COUNT OF INMATES AT 8AM EACH...
For the FULL_CT, I want to return how many people were in custody at any point in the day:
FULL_CT = SELECT COUNT(BOOK_ID)
FROM CJI_BOOK_RELEASE
WHERE TO_DATE(POP_DATE, 'MM/DD/YYYY')
BETWEEN BOOKDATE AND RELEASEDATE;)
REM I forgot to include the between...
I am trying to create a table that lists the date from the first date of a record in the system through the current date, a count at 8:00 AM Each day of how many inmates we have in the jail and a full day count of inmates in the jail. Once this table is created through today. I want to run a...
I am taking a practice test for the Intro to Oracle exam. Why is the answer: Line 1
Evaluate this CREATE TABLE statement, which line of this statement will cause an error?
1. CREATE TABLE order (
2. id# NUMBER(9) CONSTRAINT PRIMARY KEY,
3. order$ NUMBER(9) CONSTRAINT NOT NULL,
4. date_1 DATE...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.