Rivers of the name of the other table?
Hi all.. I would like to ask something about the configuration of the oracle workflow
so say like this:
-J' have 2 schemas and I want to schema1.jobs streams in schema2.dim_jobs
-Use table to schema1 have 5 columns (id, name, address, city, phone)
-dim_jobs table schema2 have 3 columns (id, name, address)
I already give the rules of the table, spread, collection procedure and apply processes...
but when I add some data in schema1.jobs the application of the schema2.dim_jobs process does not
should I insert this code of schema1 configuration?
BEGIN DBMS_STREAMS_ADM.RENAME_TABLE( rule_name => 'strmadmin.jobs_change', from_table_name => 'schema1.jobs', to_table_name => 'schema2.dim_jobs', step_number => 0, operation => 'ADD'); END; /
Thank you
Hello
In this case, please refer below doc:
Transformations of based on declarative rules (Doc ID 428267.1)
How to set up the custom rule based Transformation (Doc ID 783203.1)
And let me know in case of any concerns.
Thank you
Reena
Tags: Database
Similar Questions
-
How to join tables and get ppl not in the list of the other table
Hi, I have 2 tables
Table (girlscoutid, quarter, point)
Table b (girlscoutid, fname lname)
I want to get the names of ppl who didn't sell any point/s for Q4
girlscoutid agenda quarter 7771 drinks 4QS 9000 Tickets 4QW 7771 Cookies 2QS 5085 books 3QF 3010 Tickets 3QW 5085 Cookies 1QF lscoutid fname lname 7771 Jenn Richochet 9000 Laura Wilkins 5085 Sally Mae 3010 Dora McKenzie That's what I have, however, I get duplicates and also 7771 appears on the list even if she sold something on the 4th quarter. Any suggestions?
SELECT fname, lname, a.girlscoutid
Of a, b
WHERE a.girlscoutid = b.girlscoutid
AND the term NOT AS "4Q_";
Hello
So, all the information that you want to see figure in table b, but if you want to see it depends on the table has.
This looks like a job for a semi Join. Here's a way to do it:
SELECT b.fname
b.lname
b.girlscoutid
B
LEFT OUTER JOIN has IT a.girlscoutid = b.girlscoutid
AND a.quarter NOT AS "4Q_" - or a.TERM, if it is the column
WHERE a.girscoutid IS NULL
;
What you posted was an INNER join, where the rows of each table are included in the only game that if they have a corresponding row in the other table.
An OUTER join includes all the rows in a table (table b in this case) if they have a match in the other table. If a line of b has no corresponding row in a, then all the columns that are supposed to come from table will be NULL in the result set. Given that the join condition includes = b.girlscoutid a.girlscoutid, this means that the only way to a.girlscoutid can be NULL in the result set is if the b line is included although it has no corresponding line one, which are exactly the lines that we want to display. (You can try to run the query above with the WHERE clause, deleted, just to see how it works.)
Alternatively, you can get the desired results by using a subquery NOT EXISTS, a NOT IN subquery or analytical functions. The semi join, supra, is probably the most effective solution.
-
How to update the password on the other table based on the mod
Hello
I need to update the password for the other table based on the mod.
I have two table 'user' and 'reset '.
User:
Username username password date_exp
s232322 Bobby John sdds4545df4r 10/12/2010
s454566 George Bill f444556gh76 07/14/2010
s343466 Bill Clinton fgf54tyujkkkhj 06/12/2011
.
.
.
Reset:
Series encrypt decrypt
fgf5656fg 0 Watellemon
1 dfggf5665 lime juice
dfdffd545 2 applesalad
3 54r4gggt airlines
construction of 4 hg44hh63
5 fgf4343yh security
.
.
.
How can I update the password of a table to another table "reset"?
Ex: query
Update user set password = (select Encrypt reset where mod (length (username), 10))
If mod (length (username), 10) is 0, it should take series "0" encrypt the password and update the password in the table "user".
If mod (length (username), 10) is 1, it should take serial '1' encrypt the password and update the password in the table "user".
If mod (length (username), 10) is 2, it should take series '2' encrypt the password and update the password in the table "user".
If mod (length (username), 10) is 3, it should take series '3' encrypt the password and update the password in the table "user".
If mod (length (username), 10) is 4, it should take series '4' encrypt the password and update the password in the table "user".
....
Please help me write an update query.
Thank you
NiharHi, Nihar,
You almost had it! You just need to correlate the subquery for the main UPDATE statement, like this:
UPDATE user_table u -- USER is a built-in function; it's not a good table name SET password = ( SELECT encrypt FROM reset -- RESET isn't a very good table name, either WHERE serial = MOD ( LENGTH (u.username) , 10 ) );
-
a table are in the other table without duplicate
How to check the records in a table are in the other table without duplicate.
for example, in the tables below, the records from the Table A are in Table B1. But the B2 table has duplicate and one record is missing.
I want to know which records are not in table B, records that have two copies.
as A and B2, 1 2 is not in B2, 1 1 a 2 folders in B2
A and B1, nothing should be returned.
Table A
-----------
A1 A2
-----------
1 1
1 2
1 3
-----------
Table B1
-----------
A1 A2
-----------
1 1
1 4
1 2
1 3
2 2
-----------
Table B2
-----------
A1 A2
-----------
1 1
1 4
1 3
2 3
1 1
-----------
version is the database of Oracle 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
Thank you!!Two standard methods to compare the tables are either to use DEFINED such as UNION, UNION operations or LESS.
Or use a FULL OUTER JOIN.If the structure of the table is the same and that you want to compare all the columns, then set them operators are the best way.
If you want to compare only on one or more columns and want to see the other columns, then a FULL OUTER JOIN is the best way.
Here is an example
select A1, A2, count(distinct sourcetable) cnt_tables, count(sourcetable) cnt_records, count(case when sourcetable = 'A' then 1 end) record_is_in_A, count(case when sourcetable = 'B1' then 1 end) record_is_in_B1, count(case when sourcetable = 'B2' then 1 end) record_is_in_B2 (select 'A' sourceTable, a.* from tableA a union all select 'B1' sourceTable, b1.* from tableB1 b1 union all select 'B2' sourceTable, b2.* from tableB2 b2 ) group by A1, A2 having count(distinct sourcetable) < count(sourcetable) ;
It is an example. It will show you the records that have duplicate data in the following tables.
If you want to display all records that are in A but not in B1, you can add a few other checks.Published by: Sven w. on August 13, 2010 17:23
-
Mobile based on the size and the position of the other table
I have the impression that there is an easy solution for this... or it there is no solution at all... but here goes:
I want to use table 2 to indicate 'total time' as the sum of all time in table 1. Table 1 is set to automatically filter some lines (basically, it creates a dynamic playlist based on certain criteria). What I wish is to table 2 'float' a certain number of Table 1 below, so that as table 1 grows or shrinks according to the filtered content, table 2 remains the same distance from the bottom of table 1. Is - this unreasonable? It seems I've seen tables 'hustles' other tables according to size changes (not the desired effect in these cases, but what I DO want to here).
Hi mikey,.
This seems to be the default behavior in Numbers ' 09, but the function may not have been included in 3 numbers. I'm sure someone will test and report on it before long.
Demo below is in Numbers ' 09.
Coffee table is a double to the top. After positioning the lower level of the original table, I inserted two rows in the original and watched 'push' that the lowest low, keeping the space between them.
I reformatted the cells in column B, CheckBox and verified that a few of them.
Then I opened the Reorganize pane. and the filter rule (see the lines "... ") displayed the value:
By clicking on "see the lines...". "box produces this result:
Note: I had selected all the header cells in column B before starting the filter. The first image was captured after unchecking the checkbox 'display lines... '. "developing the table and leaving only the cells in the (previously) selected filtered lines.
As mentioned, the example is in Numbers ' 09 / numbers 3 behavior may be different.
Kind regards
Barry
-
missing parenthesis in insertion into separate lines select the table from the other table
Hello
could you help me with the following question?
I have the following tables
CREATE TABLE table1)
ID varchar (12),
col2 varchar (10),
COL3 varchar (10),
level varchar (10))
CREATE TABLE table2)
Id2 varchar (12)
A varchar (10),
B number (1)
CONSTRAINT PRIMARY KEY PK (ID2, is));
INSERT INTO table2 (ID2, A, B) SELECT ID, col2
MAX (CASE WHEN level = "level 1" then 1
level = 'level 2' then 2
Level = 3 then 'niveau3') as colIN3)
FROM table1 GROUP BY ID2, a.;
the first table have duplicates as follows:
Id2 COL2 COL3 level
A1 pepe football level1
A1 pepe football level2
A1 pepe football level1
A1 pepe basket level2
A1 pepe pingpong level3
the output should be selected with unique key (ID2, col3) lines and the level must be the greatest.
Id2 COL2 COL3 level
A1 pepe football level2
A1 pepe basket level2
A1 pepe pingpong level3
The output of the script tells me the following messages:
-lack of right parenthesis referring to the max function.
Thanks adavance.
Kind regards
Hello
Remember the ABC's of the GROUP BY:
When you use a GROUP BY clause or in an aggregate function, then all in the SELECT clause must be:
(A) a ggregate function,
(B) one of the expressions "group By."
(C) adding to C, or
(D) something that Depends on the foregoing. (For example, if you "GROUP BY TRUNC (dt)", you can SELECT "TO_CHAR (TRUNC (dt), 'Mon - DD')").
To ask him, there are 5 columns in the SELECT clause. The last one is a function MAX (...); It is an aggregate, is not serious.
The first 2 columns are also named in the GROUP BY clause, so that they are well.
The other 2 columns, country and internal_Id do not match any of the above categories. These 2 columns cause the error.
There are many ways to avoid this error, each producing different results. You could
- remove these 2 columns in the SELECT clause
- Add these 2 columns in the GROUP BY clause
- use the aggregation such as MIN, 2-column functions
- remove the country from the SELECT clause and add internal_id to the GROUP BY clause
- remove the internal_id from the SELECT clause, and add countries to the GROUP BY clause
- ...
What are the results you want?
Whenever you have a question, please post a small example of data (CREATE TABLE and INSERT statements) for all the tables involved, so people who want to help you can recreate the problem and test their ideas. Also post the results you want from this data, as well as an explanation of how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: https://forums.oracle.com/message/9362002
-
get information from inside a trigger of the other tables in the schema even
Addendum:
... Sorry I forgot: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64 bit
*******************
Hello
I'm trying for a few hours to get information from inside a trigger to another table in the same pattern.
My trigger is PSE_BKB. NUM_PHANTOM_BP
I first tried a simple solution...
CREATE OR REPLACE TRIGGER PSE_BKB. NUM_TR_PHANTOM_BP
BEFORE DELETING, INSERTION OR UPDATE
ON PSE_BKB. NUM_PHANTOM_BP
REFERRING AGAIN AS NINE OLD AND OLD
FOR EACH LINE
DECLARE
v_recht NUMBER (1): = 0;
v_recht2 NUMBER (1): = 0;
v_change_mitarbeiter NUMBER (1): = 0;
v_recht_mitarbeiter NUMBER (1): = 0;
v_typ varchar2 (20);
v_obj_key varchar2 (11): = "gugus";
v_ph_key varchar2 (11);
-ph_key varchar2 (11);
v_obj_keys varchar2 (4000): = ', ';
anz_num NUMBER: = 0;
anz_num_tmp NUMBER: = 0;
anz_st_si NUMBER: = 0;
BEGIN
...
Select count (*)
in anz_num
of pse_bkb.num_objekt o
where o.obj_key in
(select distinct (ov.obj_key)
of pse_bkb.num_objekt_verb ov
where ov.phantom_key =: old.phantom_key
)
and o.typ = "NUM";
...
Explanation: my trigger table is PSE_BKB. NUM_PHANTOM_BP.
On the pse_bkb.num_objekt_verb of the table, I have a relationship 1: n to one or several object-key (field named obj_key!) on my referenced key: old.phantom_key. With this obj_key, I want to watch the weather, I have one or more lines in the table type num_objekt "NUM". So the internal selection gives me all the num_objekt_verb obj_key with my: old.phantom_key and with whom I count the number of lines I have on num_objekt with type "NUM".
The problem is that the trigger does not see the table.
I tried many variations.
The latest version I tried was with a cursor inside the trigger definition as in the block of code below.
For debugging purposes, I inserted a RAISE_APPLICATION_ERROR in the inner loop - see below. The v_obj_key variable is never defined, as in all the other variations, I tried-, I still see the predefined "gugus" in the declare section.
It seems that oracle can not read other tables at this point. La: old.phantom_key is defined (in this simple example there would come a return obj_key).
Thanks in advance for your help - and excuse my English.
Trigger code:
CREATE OR REPLACE TRIGGER PSE_BKB. NUM_TR_PHANTOM_BP
BEFORE DELETING, INSERTION OR UPDATE
ON PSE_BKB. NUM_PHANTOM_BP
REFERRING AGAIN AS NINE OLD AND OLD
FOR EACH LINE
DECLARE
v_recht NUMBER (1): = 0;
v_recht2 NUMBER (1): = 0;
v_change_mitarbeiter NUMBER (1): = 0;
v_recht_mitarbeiter NUMBER (1): = 0;
v_typ varchar2 (20);
v_obj_key varchar2 (11): = "gugus";
v_ph_key varchar2 (11);
-ph_key varchar2 (11);
v_obj_keys varchar2 (4000): = ', ';
anz_num NUMBER: = 0;
anz_num_tmp NUMBER: = 0;
anz_st_si NUMBER: = 0;
BEGIN
Start
declare
cursor nums is
Select obj_key
of PSE_BKB.num_objekt_verb
where phantom_key =: old.phantom_key;
Start
for the RC looping nums
v_obj_key: = cr.obj_key;
RAISE_APPLICATION_ERROR (-20099,' AGAIN 9 v_obj_key: ' | v_obj_key |) ': old.phantom_key ' | (: old.phantom_key);
When the exit nums % NOTFOUND;
Select count (*) in the pse_bkb.num_objekt anz_num_tmp where obj_key = v_obj_key and type = "NUM";
anz_num: = anz_num + anz_num_tmp;
end loop;
end;
end;
Published by: user832075 on 14.01.2013 06:18The reason why you get count_n = 0 in tr_c is that there is no line in B with key_c = 17, to the moment you arrive at tr_c. The removal of B has already occurred, and since you're in a single transaction, the application for tr_c:
select count(*) into counter_n from a aa where aa.key_a in (select distinct(bb.key_a) from b bb where bb.key_c = v_ph_key ) and aa.typ = 'n';
'knows' that the row has been deleted then gets a number of 0.
I added a set of instructions dbms_output to show the order in which triggers run, and that's what I get:
SQL> delete from b_vw where key_a = 1 and key_c = 17 ; in trigger b_tr_vw In tr_b in tr_c delete from b_vw where key_a = 1 and key_c = 17 * ERROR at line 1: ORA-20077: Remark: counter_n: 0 counter_s: 0 v_ph_key: 17 old.key_c: 17 new.key_c: ORA-06512: at "OPS$ORACLE.TR_C", line 38 ORA-04088: error during execution of trigger 'OPS$ORACLE.TR_C' ORA-06512: at "OPS$ORACLE.B_TR_VW", line 17 ORA-04088: error during execution of trigger 'OPS$ORACLE.B_TR_VW'
Thus b_tr_vw trigger is triggered first and deletes a B. trigger fires tr_b as part of this statement to remove and check against A, happening apparently so no error is triggered and succeeds the removal of B. Now tr_b_vw takes back control and deletes C. Since the B line which has key_c = 17 already deleted a control for counter_n > 0 and counter_s = 0 fails and raise you the-20002 error. Note that I'm assuming that the error of-20077 you lift is just to see the values and is not intended to be part of your actual code.
Because I have really no idea what you're trying to accomplish here I can't offer a lot of advice that you might want to try entering two tr_c of the tr_b_vw trigger validation queries before deliver you the removal of b and put the counter_n > 0 and counter_s = 0 control under tr_b_vw to decide whether or not you want to remove.
John
-
Domain! = Insert then in the other Table
Hello
I can't figure out how to create a trigger that inserts data based on cases an old.field! = new.field. If the field has been changed to
a tbl_test table then insert this file into the other tbl_test_history of the table. It's a little different since I want to insert a record if an update
has taken place. The update will still take place at tbl_test, but I want an insert will be held at tbl_test_history.
I have a separate trigger that will insert records from tbl_test to tbl_test_history. This trigger compiles without error but when ICREATE OR REPLACE TRIGGER AU_INSERT_TEST_HISTORY AFTER UPDATE ON TBL_TEST FOR EACH ROW WHEN ( OLD.Orange != NEW.Orange OR OLD.Apple != NEW.Apple ) BEGIN INSERT INTO TBL_TEST_HISTORY (ORANGE, APPLE BANANA, GRAPE ) select ORANGE, APPLE BANANA, GRAPE FROM TBL_TEST, TBL_TEST_HISTORY WHERE TBL_TEST.PK_TEST_ID = TBL_TEST_HISTORY.PK_TEST_ID; END AU_INSERT_TEST_HISTORY; /
create a record in tbl_test I have an error message. I don't know if the syntax is correct, can someone help me with this?My bad. I put the colon: in the when clause. They were not there in your code. I usually use an if condition, which is a little different.
I added a NEW logic to also consider the comparison of NULL values.
CREATE OR REPLACE TRIGGER AU_INSERT_TEST_HISTORY AFTER UPDATE ON TBL_TEST FOR EACH ROW BEGIN if nvl(:old.ORANGE,'xxx') != nvl(:new.ORANGE,'yyy') OR nvl(:old.APPLE,'xxx') != nvl(:new.APPLE,'yyy') then INSERT INTO TBL_TEST_HISTORY (ORANGE, APPLE, BANANA, GRAPE) values (:new.ORANGE, :new.APPLE, :new.BANANA, :new.GRAPE); end if; END AU_INSERT_TEST_HISTORY; /
In addition, you can consider making trigger a trigger AFTER INSERT or UPDATE.
Then you would also put the values inserted early in your history table.
Published by: Sven w. August 9, 2012 16:14
-
How can I do a new insert data in the other table extrancting?
Hello, I'm looking how to do an insertion of two tables save values and apply to other tables like this:
The insert I'm looking for is something like this:
Have two tables, the first table is emp1 and contains the column: data 1 and 2 with line of data1: 1234 and line data 2:5555, therefore,.
I want to create an insert on a new table called (emp2) that contain the data in the column: data 1, data 2 (from the first table demo1), data 3, data 4, etc.
How insert again I can put / call data from another table insert in this table (emp2).
I don't know if my example is correct (my English is very bad).
This is an example: (sorry for the points).
table EMP2:
1 data... 2 data... 3 data... data 4... data 5
(from emp1)... (from emp1)... 8534... 2347... 4544
Thanks for the help.
Published by: user10182692 on 24-May-2009 08:39
Published by: user10182692 on 24-May-2009 08:40
Published by: user10182692 on 24-May-2009 08:45Welcome! on the forum.
You can include the code and data in the {code} tags
If I'm good, and I know what is your condition
insert into emp2 ( data1, data2) select data1, data2 from emp1
SS
-
It does not work when you use the trigger to check the data of the other table.
Please help me with this, I put a trigger on a table, but it can not work as I expect.
case study: a class has many students, one of them is going to match.
The purpose of this trigger is to check when to choose a student going to match, this student has in his class where it belongs to.
Oracle version is 10.2.0.1.0.
Just copy and paste on it and try to run next:--table: DROP TABLE STU; DROP TABLE CLASS; create table CLASS( CID VARCHAR2(5) PRIMARY KEY, CNAME VARCHAR2(20) NOT NULL, SCHOSEN VARCHAR2(5)); create table STU( SID VARCHAR2(5) PRIMARY KEY, SNAME VARCHAR2(20) NOT NULL, CID VARCHAR2(5) NOT NULL REFERENCES CLASS(CID) ON DELETE CASCADE); --data: --CLASS INSERT INTO CLASS(CID,CNAME) VALUES(1,'SUN'); INSERT INTO CLASS(CID,CNAME) VALUES(2,'MOON'); INSERT INTO CLASS(CID,CNAME) VALUES(3,'EARTH'); --STU INSERT INTO STU VALUES(1,'JACK',1); INSERT INTO STU VALUES(2,'TOM',1); INSERT INTO STU VALUES(3,'LILY',2); INSERT INTO STU VALUES(4,'DUSTIN',3); --TRIGGER CREATE OR REPLACE TRIGGER CHECK_SCHOSEN BEFORE INSERT OR UPDATE OF SCHOSEN ON CLASS FOR EACH ROW WHEN (NEW.SCHOSEN IS NOT NULL) DECLARE DUMMY INTEGER; INVALID_STU EXCEPTION; VALID_STU EXCEPTION; MUTATING_TABLE EXCEPTION; PRAGMA EXCEPTION_INIT(MUTATING_TABLE, -4091); CURSOR DUMMY_CURSOR (ST VARCHAR2, CL VARCHAR2) IS SELECT SID FROM STU, CLASS WHERE STU.SID=ST AND STU.CID=CLASS.CID AND CLASS.CID=CL FOR UPDATE OF CLASS.SCHOSEN; BEGIN OPEN DUMMY_CURSOR(:NEW.SCHOSEN, :NEW.CID); FETCH DUMMY_CURSOR INTO DUMMY; IF DUMMY_CURSOR%NOTFOUND THEN RAISE INVALID_STU; ELSE RAISE VALID_STU; END IF; CLOSE DUMMY_CURSOR; EXCEPTION WHEN INVALID_STU THEN CLOSE DUMMY_CURSOR; DBMS_OUTPUT.PUT_LINE('PLEASE RE-ENTER CLASS ID AND STUDENT ID AS CLASS OR STUDENT IS NOT VALID.'); WHEN VALID_STU THEN CLOSE DUMMY_CURSOR; DBMS_OUTPUT.PUT_LINE('STUDENT CHOOSE SUCCEFULLY!'); WHEN MUTATING_TABLE THEN NULL; END; /
UPDATE CLASS
SET SCHOSEN = 3
WHERE CID = 1;
Clearly, you can't student who is 3 as to Member of class 1. Please help me. Thank you.
Published by: 991096 on March 1st, 2013 02:36
Published by: 991096 on March 1st, 2013 03:03
Published by: 991096 on March 1st, 2013 03:11Hello
991096 wrote:
1. the purpose of this trigger is to check when to choose a student going to match, this student has in his class where it belongs to. Then, when I try to choose 3 student-member of correspondence of class 1, should give me "PLEASE RE-ENTER ID AND STUDENT ID AS CLASS or STUDENT not IS NOT VALID."Then do something like this:
CREATE OR REPLACE TRIGGER CHECK_SCHOSEN BEFORE INSERT OR UPDATE OF SCHOSEN ON CLASS FOR EACH ROW WHEN (NEW.SCHOSEN IS NOT NULL) DECLARE sid_found stu.sid%TYPE; BEGIN dbms_output.put_line (:NEW.schosen || ' = schosen entering check_schosen'); SELECT sid INTO sid_found FROM stu WHERE sid = :NEW.schosen AND cid = :NEW.cid AND ROWNUM = 1 -- to avoid TOO_MANY_ROWS ; EXCEPTION WHEN NO_DATA_FOUND THEN RAISE_APPLICATION_ERROR ( -20000 , 'Please re-enter class id and student id as class (' || :NEW.cid || ') or student (' || :NEW.schosen || ') is not valid.' ); end; /
DBMS_OUTPUT creates only a message. The message may not be displayed, and if this is the case, then the user cannot see it. The DML will still take place.
I used instead, RAISE_APPLICATION_ERROR to keep the DML does not happen. It displays a message likeORA-20000: Please re-enter class id and student id as class (1) or student (3) is not valid.
' 2 ' game ' means ' an official competition in which two several people or teams competing.
What individuals or teams are competing in this case?
In any case, the question wasn't 'that 'game' means', butFrank Kulash wrote:
What do you mean when you say "going to match?I think that now you're saying that the new values of (class.cid, class.schosen) must be equal to (or "fit") some existing (stu.cid, stu.sid).
3. thanks for your tip, I learned how to use '{code} '.
4. it's really goes with the exception of MUTATING_TABLE. So, how do to fix the trigger to show me INVALID_STU EXCEPTION when I try to choose a student does not belong
a class?Don't refer to the table of class in the trigger, and the error table mutation occur. All the information you need are in the stu table, so there is no need to query the table of class, anyway.
-
How to extract the values of the other tables in the process upon request
Hi all
In Oracle Apex 4.1.
The Leave_transaction Table contains the following fields,
The Emp_Master Table contains the following columns1.Leave_id 2.Emp_name 3.From_date 4.To_date 5.Remaining_days
Holiday_master table contains a list of the dates of the holidays as 'From_Date '.1.Emp_id 2.Emp_Name 3.Remaining_days
I have the form based on the Leave_Transaction Table,
I created the process,
"Sur-Soumettre after calculations and validations of."
and posted the following PLSQL code,
If the date is between from_date and To_date comes Saturday and Sunday or if any Date exists in the table of Hpliday_master he will exclude and return the count (*) rest of dates.declare days number(3); ex_days emp_master.remaining_days%type; new_rem_days emp_master.remaining_days%type; begin select count(*) into days from (select dt from( select to_date(:p1_from_date, 'DD-Mon-YYYY') + rownum -1 dt from dual connect by level <= to_date(:p1_to_date, 'DD-Mon-YYYY') - to_date(:p1_from_date, 'DD-Mon-YYYY') + 1) where to_char(dt,'fmday') not in ('sunday','saturday') minus (select holiday_start from holiday_master)) dual ; select remaining_days into ex_days from emp_master where upper(emp_name) = upper(:APP_USER); new_rem_days := ex_days - days; update emp_master set remaining_days = new_rem_days where upper(emp_name) = upper(:APP_USER); update leave_transaction set remaining_days = new_rem_days where upper(emp_name) = upper(:APP_USER) and leave_id=(select max(leave_id) from leave_transaction); end;
For example,.
If the From_date is 04-may-2012'
and To_date is 08-may-2012,
Here the dates 5 May and 6 may are "Saturday" and "Sunday".
and if any date between From_date and To_date is exist in the Table Holiday_Master
That is to say that here it is 07-may-2012,
Then the remaining dates are (excluding sat, Sunday and dates in holiday_table).
04-may-2012,
08-may-2012.
the count (*) is 2.
I use the code above but it return 5.
I think that this
code does not work....where to_char(dt,'fmday') not in ('sunday','saturday') minus (select holiday_start from holiday_master))
Can someone help me solve my problem.
Edited by: Gurujothi may 3, 2012 23:59set serveroutput on; declare v_sql varchar2(100); begin v_sql := 'ALTER SESSION SET NLS_LANGUAGE= ''GERMAN'''; execute immediate v_sql; dbms_output.put_line(v_sql); for c in ( select to_char(sysdate + level ,'fmday') day_ from dual where to_char(sysdate + level,'fmday') not in ('sunday','saturday') connect by level < 8 ) loop v_sql := c.day_; dbms_output.put_line(v_sql); end loop; v_sql := 'ALTER SESSION SET NLS_LANGUAGE= ''AMERICAN'''; execute immediate v_sql; dbms_output.put_line(v_sql); for c in ( select to_char(sysdate + level ,'fmday') day_ from dual where to_char(sysdate + level,'fmday') not in ('sunday','saturday') connect by level < 8 ) loop v_sql := c.day_; dbms_output.put_line(v_sql); end loop; end; / ALTER SESSION SET NLS_LANGUAGE= 'GERMAN' samstag sonntag montag dienstag mittwoch donnerstag freitag ALTER SESSION SET NLS_LANGUAGE= 'AMERICAN' monday tuesday wednesday thursday friday PL/SQL procedure successfully completed.
-
Release of updated with the value of the other Table
Hello
I need the sum there point TableB and insert/update this value in the X field in TableA. I can do this with select statements regular when I add values in my statement, but I'm getting errors now. Need help on how to code the trigger to do this, thank you.
ORA-00936: lack of expression
SELECT a.X, SUM(b.Y), INTO a.X FROM TableA a, TableB b WHERE a.PK = b.FK;
Ok. I think I understand now what's going on. Think logically that you create the customer first and only then customer can create orders, right? So when you insert a customer into the table DEMO_CUSTOMERS there is no customer order in the DEMO_ORDERS table. As a result, the CREDIT_LIMIT column remains NULL.
SY.
-
How to render a table on the value of the column in the other table. in the adf.
I have an A.It table have a column b column B have value is xxx then table C will go to true.any you suggest how to achieve this.
I use jdev 10.1.3.3
Please suggest
Thank you
Emine
Published by: vinay kumar on March 27, 2009 18:51You can use in the detail of the line?
In this case, put the af:table component in the af: column and assess the condition of rendering on the value of the column.
Tocarli
-
How to compare one by an element of a column with the first column in the other table?
Hello
I have two files into a single file has only Id numbers and the second file has table with for example the column 4, and his first column identification number.
So I want to compare the first item in the User.ID file with the 1st column all the table file items in this column until it finds matches.
If compare match then LED will be IT other wise LED will be OFF.
Here as an attachment, I've attached the two file.
Please guide me how can I do the same thing.
Thank you much in advance.
-
Subselect statement - the sum of the other Table
Hello
I need to get stock parts information.
I can query two tables, but need to get two other money in stocks to a third table.
SELECT ac.saext AS Satzart
ac.raint AS SatzarKZ
ac. MNR AS Teilenummer
ac. KTXT AS description
acd.mindbestand AS Mindestbestand
acd.sichbestand AS Sicherheitsbestand
ac.wbz
SELECT Sum (E_STATICQUANTITY) relwmsstocksum m
WHERE itemno in (ac.mnr)
OF new settler Lake CA
inner join Relacd CDA ON ac.mnr = acd.mnr
Inner Join relwmsstocksum m
My problem ist information sum of the table relwmsstocksum m
The new settler LAKE Table is linked to the table relwmsstocksum by: MNR = ITEMNO.Which is wrong in my query?
Looks like you need something like (not tested, if it does not meet your needs, post a test case and some details about your needs.)
SELECT ac.saext AS Satzart ,ac.raint AS SatzarKZ , ac.MNR AS Teilenummer , ac.KTXT AS Beschreibung , acd.mindbestand AS Mindestbestand , acd.sichbestand AS Sicherheitsbestand , ac.wbz , Sum(sts.E_STATICQUANTITY) FROM relac ac inner join Relacd acd ON ac.mnr = acd.mnr Inner Join relwmsstocksum StS on sts.itemno = ac.mnr group by ac.saext ,ac.raint , ac.MNR , ac.KTXT , acd.mindbestand , acd.sichbestand , ac.wbz
Maybe you are looking for
-
Win7 Home x 64 to Win7 Professional update
Hello Just bought the z830 which comes with Windows® 7 Home Premium (64-bit) and I was wondering can I put it to Win7 Pro (32-bit)? I have the CD Pro Win7 already, but I just want to see if there will be any hardware and software issues? and how to c
-
HP Pavilion 1219tx g6: webcam not working not
No messages don't pop ip, just at the moment where trying to Skype the integrated webcam is not working do not, yet same brand etc computer bought in New Zealand at the same time (bought mine it so) works perfectly. Show just my picture on the screen
-
Sansa fuze updated 1407 on 06/06/14
I got burned by the updates before due to dislike changes. Y at - it info everywhere on that includes this update? Thank you PAM
-
make a slideshow in movie maker, how to extend the duration of a photo of a single image
make a slideshow in movie maker, how to extend the time image (time peak is seen) a single image that is different from the default time?
-
ASA L2L IKEv1 5520 no information of its crypto isakmp
Here is the config... and show isa scream his ---------------------------------------------------------------------------------------- Dathomir - ASA (config) # see the isa scream his There are no SAs IKEv1 There are no SAs IKEv2Dathomir - ASA (confi