PL/SQL :: Assign Count Of Committed Rows To Variable
Sep 4, 2012
from within plsql i am doing
insert into t_target (...) select (fiels,fields,fiels) from sourcetable;
commit;
i want to capture number of rows committed and assign it to a variable or insert it into a table, i can not rely on count of source table or t_target because both those tables are changing through out of the day/ data are being inserted and removed from those tables. is this possible
Write a program to declare a date variable and assign it to the current system date. Depending on the day of the month the program should print the following:
If day is 1-10 then print "It is day<day number> of <month name>. It is early in the month". If day is 11-20 then print "It is day<day number> of <month name>. It is the middle of the month". If day is 21-31 then print "It is day<day number> of <month name>. It is nearly the end of the month".
For example, if the day is November 30, then print "It is day 30 of November. It is nearly the end of the month".
I'm trying to return the number of records in my link table that contains the excursion_id I pass in by counting them. It doesn't seem to like the select count(*) into my output variable.
create or replace PROCEDURE BOOK_PASSENGER( EXCURSION_ID IN excursion_booking.excursion_id%TYPE, PASSENGER_ID IN excursion_booking.passenger_id%TYPE, NUMBER_BOOKED OUT NUMBER) AS BEGIN INSERT INTO EXCURSION_BOOKING VALUES(EXCURSION_ID, PASSENGER_ID, NULL); SELECT COUNT(*) INTO NUMBER_BOOKED FROM EXCURSION_BOOKING WHERE EXCURSION_ID = EXCURSION_ID; END BOOK_PASSENGER;
I used Region, Process by to search the report which appears as shown above. Then I use Choose Auditors column to select my Auditor and copy paste it into the report under To be Audited By col. Is there a way to automate the process. I am here using a tabular form in APEX. My main aim is to assign auditors based on Region, not equal to Processed by.
I have a form which will call another and do some transactions and come back to original form and do other processes. save if successful. or roll back with error message.i m doing POST when i exit from the called form. and continue process in calling form. if any error, i m raising an error message with rollback.
But sometimes, it is getting committed with that error trn. especially in new database, first time try the scenario, it any error comes then getting commited.I m not able to find where the commit is happening? if any other sessions commit will affect this trn?
select partition_name, num_rows from dba_tab_partitions where table_name='Partisi_Book_Issue';
it display 0 num_rows. But i have made non partitioned table to partitioned table with the same number of rows. how to display number of record in each partition in any table?
I need to get the number of rows based on one condition for certain time period. For example, writing a query for 3(any) hrs , i need to get the output as count of rows as hourly basis. Like these:
Date Time Count 12/08/2010 16:00 234 12/08/2010 17:00 345 12/08/2010 18:00 645
I want to create a SELECT, that shall give back only a special amount of rows, depending on the sum of one of the selected fields.
At first a code sample of the complete selection:
SELECT DISTINCT mnr, ktxt, (SELECT Sum(meng_4)FROM reldb d1 WHERE d1.mnr=d.mnr)qty FROM reldb d WHERE mnr IN (SELECT mnr FROM relac WHERE Lower(rlnr) NOT LIKE 'platte geprägt%') AND saext='M' ORDER BY qty DESC,ktxt;
This selection produces some lines of output (in my case i.e. like 300). What I want to see is only that much lines that the condition 'sum of all items listed below meng_4<=sum of all items meng_4 of the whole selection * 0.9' is fulfilled.
So, if the whole selection produces a total of 10000 as sum for all items meng_4, I want to see only that amount of rows that sums a total of at least 9000 for all items meng_4. I hope, this specification is exactly enough to understand my intent.
I have a I/R report with a checkbox is column 1 of each row using:
HTMLDB_ITEM.CHECKBOX (1,R.RESEARCH_ID, decode(:Pxx_SELECT_ALL_ROWS,'Y','CHECKED', decode(instr(nvl(:Pxx_SELECTED_IDS,0),R.RESEARCH_ID),0,NULL,'CHECKED')) ) AS select_flag
I want to use Javscript or a Dynamic Action to "count" how many selected rows there are, when a UPDATE button is pressed. Right now, the UPDATE button "submits" the page, then a page item computation runs the following code to get a count:
DECLARE v_cnt number(9); BEGIN v_cnt := 0; FOR i in 1..htmldb_application.g_f01.count LOOP v_cnt := v_cnt + 1; END LOOP; return v_cnt;
This works... but I dont want to submit (and rerun the report) just to get this count.
I have copied this loop into a Dynamic Action using the Click action of the UPDATE button, but it doesnt seem to recognize htmldb_application.g_f01.count .. so my value returns as 0.
I'm trying to run a script that will sum column values from a table using only a certain period of time in example below only January submissions. However, some of those rows have the same date and I want to have the latest time row of that day in the count.
I had as source a set of actions where I have to assign the end date, the general rule is that each action has the same end date to start date of next action, if there is no next action it will be assigned the default('35001230').
I can do the assignment with the date of order:
NVL (LAG (DAT_INI) OVER (PARTITION BY ID_CLIENT DAT_INI ORDER BY DESC, DESCCOD_SEVERITY), TO_DATE ('35001230 ',' YYYYMMDD ')),
However, I have an exception to the rule, if the action have COD_SEVERITY = 3 or 4 and the next action have the COD_SEVERITY = 3 or 4, the end date will be for the previous day. If in the same day I have actions with COD_SEVERITY 3 and 4, the end date of actions with COD_SEVERITY = 3 will be DAT_INI -1 and the action with COD_SEVERITY = 4 will have the same date of the next action or DAT_INI -1 if the next action had COD_SEVERITY = 3 or 4
The source SELECT 1 as ID_CLIENT, 20111201 as DAT_INI, 1 as COD_SEVERITY, 100 as VALUE FROM DUAL UNION ALL SELECT 1 as ID_CLIENT, 20111201 as DAT_INI, 3 as COD_SEVERITY, 100 as VALUE FROM DUAL UNION ALL SELECT 1 as ID_CLIENT, 20111204 as DAT_INI, 4 as COD_SEVERITY, 101 as VALUE FROM DUAL UNION ALL [code].......
begin declare tmdate DATE; select TO_DATE(TO_CHAR(MAX(DATERANGE),'DD-MON-YYYY')) into tmdate from table_check_date_range; dbms_output.put_line(tmdate); end;
Assign employees to their jobs in consideration the maximum number of employees to each jobs is 5 employee plus each job has own the maximum number of employees
we need the maximum number of employees for each job 5 to be variable when need to change this maximum for certain job , change this number from database (form the from of job ) not form code )
tables emp emp_no name manager hiredate salary
job job_no job
you can add tables or attributes to tables to complete you business.
create table mypart(a number, b number, c number, p_key number) PARTITION BY RANGE (p_key) ( PARTITION p0 VALUES LESS THAN (18), PARTITION p1 VALUES LESS THAN (29), PARTITION p3 VALUES LESS THAN (MAXVALUE) ) ENABLE ROW MOVEMENT;
create index idx_mypart on mypart(p_key,a,b)
I want to create primary key on this table that will use the local partitioned index idx_mypart
can I do that ?
alter table mypart add constraint pk_mypart primary key using index (idx_mypart)
above syntax gives error
basically the primary key should make use of the local partitioned index.
assigning values to a particular variable that i need for my button trigger. I Understand that you can assign multiple values to a variable that has a varchar or char data type....is there a way to assign multiple values to a variable that has a 'number' data type?? I need this for my 'where' clause
declare usergrade varchar(4) := 'pass'; user_unitcode number(6) := ;--needs three unit codes to equal pass
One Text item is there in FormPARN, near to that Text item, Button is there.While clicking Button FormCHLD will be opened. Inside the FormCHLD, i will do some calculation and i need to store the result in FormPARN's Text Item.
I have two blocks in Form (Forms 10g) .On the Block B2 I have populated the Company Id by using the PLSQL Table.Now I selected more than two company ID from that Block ...I just want to keep the Company ID in the Temp Field on the Block B1.which I have selected on the Block B2. how can I assign more then one Company ID to That Temp Field on B1.