I wanted to create shift rota for the employees as per the below conditions.
1). Shift should be rotated.(it should check previous 2 shifts and assign to another shift).
2). The same employees should not be allocated for the next shift .
Ex : Now jones, jekku, henry and villiams are in "C" shift . So the same employees should not be allocated to the next shift, it should be random. Some of these employees should be allocated to "B" and some employees should allocated to "A" shift....
Below are the SQL statements to create the table and input the data..
alter table resource_details add constraint res_pk primary key(empno) ;
insert into resource_details values(51370 , 'Finney' , 'A') ;
insert into resource_details values(51371, 'Jerry' , 'B') ;
insert into resource_details values(51372, 'Jones' , 'C') ;
insert into resource_details values(51373, 'Smith' , 'A') ;
insert into resource_details values(51374, 'Krishna' , 'B') ;
insert into resource_details values(51375,'Chenna','A');
[code]....
I have tried with employee number to check which shift he is/was in & assigned the shift accordingly , but here shift is getting rotated but not employees(same employees are going to the next shift, which should not be accepted..)
I'm trying to figure out, based on total scheduled shift time and scheduled breaks what the effective schedule time is by hour for a particular employee.
So I have a shift query that gives me this (using a cross-day shift here because they do happen-not sure if that will impact things):
I have a 10G Express system running. I Have 2 tablespaces in production. WHen taking backup, it terminates unsuccessfully saying system01.dbf is damaged. The application works fine and no data loss is found through the application interface.
So can I shift the data to a new server using the dbf files of the tablespaces in use?
I want to get 10 random numbers from existing 100 numbers. How can we get/generate random numbers ?
for example I have a table with customer ID, customer Name, having 100 record. We want 10 customers ID randomly from that 100 record not repeated any number. Have any command or procedure for that ?
i want that when i run above query every time bas_cod column should start with difference value. now it is starting from 1, i need when i run next time it should start with another number except 1,
i mean whenever i run above query,order of bas_cod must be change from last.
I am trying to create a csv file with summarized data. We have a huge table with claim details that is constantly being updated. I am pulling a subset of records that match my criteria into a tempory table (not technically an Oracle temporary table, a regular table that will only exist until I drop it when I am done). This table has multiple entries per claim with different effective dates, paid dates and amounts paid. The result file needs to have one entry per claim with the oldest effective and paid dates and the total of all of the amounts paid on that claim.
Originally I was doing create table new_table as select claim_nbr,other data...,min(ymdeff),min(ymdpaid),sum(amtpay) from my_table group by claim_nbr,other data...
If I ran a select sum(amtpay) from my_table and select sum(amtpay) from new_table I was not getting the same results... If I ran select count (*) from (select distinct claim_nbr from my_table) and select count (*) from (select distinct claim_nbr from new_table) or select count (*) from new_table I was getting the same number of rows. So I wasn't completely losing claims from one table to the next, just some of the details. So, I tried running this:
select * from (select claim_nbr,sum(amtpay) paysum from my_table group by claim_nbr order by claim_nbr) m, (select claim_nbr,sum(amtpay) paysum from new_table group by claim_nbr order by claim_nbr) n where m.claim_nbr = n.claim_nbr and m.paysum <> n.paysum;
It came back with the claim number causing the issue. I looked at all the entries in my_table for that claim and every field was identical except the ymdeff, ymdpaid and amtpay. There were 4 records in my_table however the amtpay in new_table was only a sum of 2 of the records... I our admin look over my shoulder to see what was wrong and they wanted me to recreate new_table. So I dropped new_table and ran the exact same SQL to recreate the table. The number of distinct claim numbers was still the same in both tables and the sum of new_table was off but not by the same amount. I ran my comparison to see which claim was off and now there were two claims where the totals didn't match and neither were the same as the claim that was wrong that first time. We dropped new_table and recreated it several times and every time we got different results... No one else knows the name of my_table so no one was messing with it at the same time plus the sum of amtpay in my_table always comes back the same.
Our admin said he thought he remembered there being something "funny" with the min function sometime so he had me remove those fields. Ran the query several times and the total came out correct each time. Well I still need the dates so I came up with another way (very convoluted) using subqueries and ranking. It seemed to work at first then it started losing random numbers of claims (fewer rows in new_table than distinct claims in my_table) or keeping all the claims but dropping detail lines like I had using the min functions.
Here is the backwards way around using min that drops whole claims sometimes but works fine other times:
CREATE table new_table as (select claim_nbr,other data...,amtpay,ymdeff,ymdpaid from (select claim_nbr,other data... ,sum(amtpay) amtpay from my_table group by claim_nbr,other data...
i have a parameter form where user will input from item to item and items within this range will be come as output , but i want an option to select the random items from the list, like i may not select all the items from 1 to 10 , but instead i want to pick or select randomly , i may opt for 1,3,4 and 7.
I have this requirement in Oracle FORMS ver 6i where I populate some records in a table in a datablock and display them on the screen. A facility needs to be provided to the end users to select the records randomly by just entering the count of the records in a non-d/b text field. The number entered in the count field will decide how many records are to be selected randomly.
I tried using the query -
UPDATE <table a> SET <col 1> = <value 1> WHERE rowid IN (SELECT rowid FROM (SELECT * FROM <table a> ORDER BY DBMS_RANDOM.VALUE) WHERE <col 2> = <value 2>) /
which I found on the link [URL] but while compiling, the Form gives a compilation error for the ORDER by clause - i'm sure there's no syntax error in the way I have written it...
i need to copy data from certain table's from one DB to another at random intervals. Table structure for the one's getting copied can be same in both the DB.
After reading various posts here i have understood that it can be done using Oracle Replication and Oracle stream.
how these 2 methods work and how they are different from each other.
select null, '0-10' Days , count(*) from tableunionselect null, '11-20' Days, count(*) from tableunionselect null, '21-30' Days, count(*) from tableunionselect null, '>30' Days, count(*) from table
The 3d pie chart was showing the slices is the correct order 0-10, 11-20, 21-30, >30 but now shows it in random order. how to get the order by working. I suspect since the Days column in the select is a Character column this issue is occurring, however, with the restrictions in the number of select items we can have in the Apex charts, was wondering how do you get the order by working?
I need to generate random and unique 6 digit number in Oracle. I need to insert these numbers into a table. I tried using DBMS_RANDOM package, which generates random 6 digit numbers, but fails to generate UNIQUE numbers.
How can i shift my datafiles to other drive like d: , they have become very big. and i also want to take backup on other drive like d: and oracle is installed on c:
I need to create PROCEDURE to create user in oracle
CREATE OR REPLACE PROCEDURE "CREATE_USER_ORACLE8" ( USER_ID in VARCHAR2, PASSWORD in VARCHAR2, ROLES in VARCHAR2, nReturnCode OUT NUMBER ) BEGIN [code].......
Compilation errors for PROCEDURE NOG.CREATE_USER_ORACLE8
Error: PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following:
; is with authid deterministic parallel_enable as Line: 9 Text: BEGIN
i want that the customer execute PROCEDURE (user_id,password,PROCEDURE )
ORA-06502...I have database on oracle 9i on Solaris 9. I create a generate procedure that create dynamic procedure through DBMS_SQL. On this database I got the ORA-06502 error. When I tried to run the same procedure on the same database on oracle 8i on NT this work fine.
ORA-06550: line 1, column 93: PLS-00201: identifier 'PKG_MAINTENANCE.MAINTENANCE_PURGE' must be declared ORA-06550: line 1, column 93: PL/SQL: Statement ignored ORA-06512: at "SYS.DBMS_JOB", line 82 ORA-06512: at "SYS.DBMS_JOB", line 139 ORA-06512: at line 4
I have oracle 11.2.0.2 on Linux. I have question regarding that i have last week (1/26/2013) hot backup of database and cold backup from (dec 9 2012). and user needs data from the database but needs to create new db.
how can i do that to create new db with Hot backup of last week?
As per project requirement, we need to create tab seeprated file for a table. This table contain around 1000000 records.I have written below sql
set pagesize 10000 set feedback OFF set serveroutput on set heading OFF spool D:OfficeworkDatabase_maintainceMATRIX.txt
[code]...
This query is taking more than 6 hours.if there any other way how can we create tab separated file. Or we can export the entire table in tab separated file format.
I want to create a new table 'b' from table 'a'.I know the query will be " create table b as select * from a;" But there is some twist in my question. I do not know how many table are there in table 'a' all I know is that there is one column named "timestamp" in table 'a'.
Now I want to create table 'b' with the difference that the column "timestamp" should contain the value "sysdate" instead of the earlier values which were there in table 'a';
Note: I have to do this in single query. I can not first create table 'b' from 'a' and then update the values of column "timestamp" to sysdate.
how to create the trigger that count the last 7 day about from sale table if the last 7 day amount is greater then 10000 then update the commission 2% other wise do nothing
I want to create one dummy job using dbms_jobs and execute it under BALA user.This is just for testing purpose.My goal is to test Whether the job executes successfully under the new user i created BALA. All these should happen under BALA user.