delete records of the condition-based BAM data object
Is it possible to delete files or data data object when any user defined condition occurs? This means that I have used the data object which consists of salary, I want to delete all data in the BAM data object when the salary is higher than 700000.Yes. You must create an alert in Active Studio which will remove based on this condition. Choose an event (each date interval starting at a specific date, at a specific time), and then select the action 'Clear data from a data object', choose your object data, and then add a filter for salary higher than 700000. Once the time comes it will remove the records.
-Keith
Tags: Fusion Middleware
Similar Questions
-
process BPMN 11 g does not receive data in BAM data objects
Hello
I have a question which I do not get the instance data in default BAM data objects (COMPONENT, COUNTER and INTERVAL have 0 rows) when launch and test an instance of my approach. I did the following:
-created a simple SOA/BPM project with a simple process. Interactive 2
-together project preferences/analytical summary of sampling points to 'Generate for all activities' in the TEMPO of the project and set the target of data to "BAM", set the adapter JNDI name and kept by default data Path object (/ samples/monitor Express). I checked the processes and activities of sample Points and they all inherit
-J' deleted data objects using the BAM architect and redeployed my simple application
-Although I have a few unique constraint errors (I found a few articles on it but don't not fixed) 3 data objects get created ok
-J' I then test my application in Enterprise Manager and click on the second interactive
-At this point I expect to see the data in the BAM data objects, but I don't see any. Always 0 rows :-(- am I right to expect something?
-I see no error in the weblogic console when using the instance
Any ideas what I can check next?
see you soon
TonyHi Tony,.
Content of the data objects BAM are not met, unless some action to disable, remove process measures to send to the BAM engine is disabled.
Connect to Oracle Enterprise Manager Fusion Middleware console and navigate to soa-infra > SOA Administration > BPMN properties > BPMN more Configuration properties to display the BPMN configurable engine MBean properties.
Scroll the list to check the DisableActions property.
The default value of this property is BAMCommand, what actions of measure removes to send to BAM. Disable this field (leave it blank) and save the settings.
Look below the post to find the screenshots for same.
http://beatechnologies.WordPress.com/2012/11/08/open-a-workflow-task-or-instance-trail-from-Oracle-BAM-11g/Kind regards
Afonso -
Create dummy records using the model cluase with date field condition
Hi all
I have two tables below:
create the table Interest_date
(
date of interest_date_field,
Number of Interest_amount
);
create the table sys_date
(type varchar2 (30),)
date_value date
);
Insert all
IN Interest_date values (to_date('01-11-2012','DD-MM-YYYY'), 20)
IN Interest_date values (to_date('01-12-2012','DD-MM-YYYY'), 40)
IN Interest_date values (to_date('02-01-2013','DD-MM-YYYY'), 60)
IN Interest_date values (to_date('01-06-2013','DD-MM-YYYY'), 80)
IN Interest_date values (to_date('01-07-2014','DD-MM-YYYY'), 10)
IN Interest_date values (to_date('25-11-2014','DD-MM-YYYY'), 20)
INTO SYS_DATE VALUES ('FIRST_DATE',TO_DATE('01-06-1900','DD-MM-YYYY'))--note: the year is not important but the date is used for other
INTO SYS_DATE VALUES ('FIRST_DATE',TO_DATE('01-12-1900','DD-MM-YYYY'))--note: the year is not important but the date is used for other
Select * twice;
Requirement:
I need to write a select statement that retrieves all the records in interest_date and add a dummy record according to what follows:
-in NO case of JJ - MM interest_date_field for a given year (year group) = DD - MM of the date_value in sys_date where the type is "FIRST date"-> add a dummy record (date_value for type FIRST_DATE yyyy = year of interest_date_field, - 1)
-in NO case of JJ - MM interest_date_field for a given year (group by year) = DD - MM of the date_value in sys_date where the type is 'SECOND DAY'-> add a dummy record (date_value for type SEOND_DATE yyyy = year of interest_date_field, - 1)
Desired output:
Interest_date_field Interest_amount
06/01/2012-1
11/01/2012 20
12/01/2012 40
01/02/2013 60
06/01/2013 80
12/01/2013-1
06/01/2014-1
07/01/2014 10
25/11/2014 20
01/12/2014-1
Thank you very much
Ferro
Why not combine the first with the second approach:
with the years as)
Select distinct
TO_CHAR (interest_date_field, "YYYY") y
of Interest_date
)
year_dates as)
Select
to_date(y||) MD, 'YYYYMMDD') d
years
(to_char(date_value,'MMDD') md by selecting in SYS_DATE)
)
Select
I have interest_date
an interest_amount
of interest_date
model
dimension (interest_date_field i)
measures (Interest_amount a)
rules)
a [for i (select year_dates d)] = nvl (a [cv ()],-1)
)
i order
-
Restrict the records in the CSV, based on condition
Greetings. I searched the forum for my problem and have not found an answer or the right search terms. I'm under APEX 4.1.1
I have a report on a page. I show all the records to a SQL query given in my table, but in the 'export to CSV' I need limit the output based on one of the fields. Thus, for example, if I had a report such as:
SELECT x, y, Z
FROM Table1
I would like to export to CSV format for this table to limit the output such as:
SELECT x, y, Z
FROM Table1
WHERE Z = 1
Is this possible?
Thank you!
JohnHi John,.
I tested the connection now and works above for interactive report only and for the classic report, you need to do something like that because the demand is set to a different value
SELECT x, y, Z FROM Table1 WHERE ((Z = 1 and nvl(:REQUEST,'X') like 'FLOW_EXCEL_OUTPUT%') OR nvl(:REQUEST,'X') not like 'FLOW_EXCEL_OUTPUT%')
See this example of work http://apex.oracle.com/pls/apex/f?p=46417:25
When you export to CSV you'll get 10 dept records
-
In our application, we try to add and delete records within a one: iterator lie to the backing bean list table.
According to the feature remove should not fire any validation form so we are settign Remove button including the immediate property. And add can throw validation before adding a new record.
Here the problem comes with button Delete with activated immeidate. The deletions list action recording is removed from the collection list at the beacking bean, but after that the interface iterator partial page refresh user displays with bad Recordset. Some how instead of getting the last recordings of server of the user interface displays the previous local values for input components.
For example: if I have 5 files in the list and delete record 2nd of collection. Backing bean (server side) the 2nd record is perfectly removal of list collection.
On the user interface, the iterator 4 records are displayed as the size of the list is 4, but instead of 2nd record the last record is not rendered. According to my understanding, as deleting comme la suppression touche key is set immediately then the some how these recordings (genereted the Id of component runtime inside the i1: 0:it1 etc...) Apply request vandekerckhove is not updated gettign, Hene showing the old local values inplace of these components of entry and this behavior is only for input components.
Can you suggest me a solution more come to the question above. Delete with immediate should unregister correspondent and only the record deleted if pannals UI.
JSFF code
<af:panelGroupLayout id="pgl1" binding="#{viewScope.formBB.mainPGL}"> <af:iterator id="i1" value="#{viewScope.formBB.allEmployees}" var="emp" rows="0" varStatus="vs" binding="#{viewScope.formBB.iteratorBinding}"> <af:panelFormLayout id="pfl1" maxColumns="4" rows="1" labelAlignment="top"> <!--<af:outputText value="#{vs.index}" id="ot1"/>--> <af:inputText label="First Name" id="it1" value="#{emp.firstName}" autoSubmit="true" required="true"/> <af:inputText label="Last Name" id="inputText1" value="#{emp.lastName}" autoSubmit="true" required="true"/> <af:commandImageLink text="Delete" id="cil1" immediate="true" actionListener="#{viewScope.formBB.deleteEmployee}"> <f:attribute name="index" value="#{vs.index}"/> </af:commandImageLink> </af:panelFormLayout> </af:iterator> <af:commandButton text="Add New Employee" id="cb1" actionListener="#{viewScope.formBB.addNewEmployee}"/> <af:spacer width="10" height="10" id="s1"/> </af:panelGroupLayout>
Delete the Action listener for the bean
private List <Employee> allEmployees; public List getAllEmployees() { return allEmployees; } public void deleteEmployee(ActionEvent actionEvent) { int index = (Integer) actionEvent.getComponent().getAttributes().get("index"); if(allEmployees != null && allEmployees.get(index) != null) { System.out.println("Emploeye Name:" + allEmployees.get(index).getFirstName()); allEmployees.remove(index); } //AdfFacesContext.getCurrentInstance().addPartialTarget(mainPGL); AdfFacesContext.getCurrentInstance().addPartialTarget(iteratorBinding); } public void addNewEmployee(ActionEvent actionEvent) { Employee addE = new Employee(); if(allEmployees != null) { allEmployees.add(addE); } else { allEmployees = new ArrayList <Employee>(); allEmployees.add(addE); } AdfFacesContext.getCurrentInstance().addPartialTarget(mainPGL); }
Jdev version - Build JDEVADF_11.1.1.7.0_GENERIC_130226.1400.6493
POC Application - https://drive.google.com/file/d/0BysBrGAsXoo0Qjh3VGkzZkRGck0/view?usp=downalod
Help, please.
You probably need to reset submitted values.
For this, you can use this util class: ResetUtils (reference Java APIs for Oracle ADF Faces)
For example: ResetUtils.reset (iteratorBinding);
BTW, you should never bind components to bean managed with a scope greater than the scope of the request.
Dario
-
Hello
I need where there are quick dashboard that selects the date, second interval column consists of >, <, = and the third column is seen number (in days)
for example, the user enters: 12 18, 2015, <, 9. here I report who should get the data (records) 9 days earlier from the date specified (from 12/10/2015 to 18/12/2015).
Similarly for > =.
How to get there. I'm unable to write the script and I use the column date in my report. Ask that you please advice how to solve this problem.
Please find below the screen for reference.
Kind regards
Chandra Khalil.
Hello
Not exactly why you're doing the report this way. If the user must select, basically, a period of dates, would not easier to have a column of data with a between the operator and the user would select 2 dates (upper and lower intervals)?
In any case, it is possible to achieve what you want to do as a result of your approach. You could use when's CASE and have a more complex filter, but I think that it is better to have a few nested filters where you use the range operator to determine what date filter that you use (see image below)
Some notes about my filter. First of all, I am making the assumption that the operator is "=", then the number of days specified must be ignored and you just return the data for the selected date. You will notice also that in my filters, I got a cast so far, but if you are using a column that is already a timestamp so it won't be necessary.
This should achieve what you want.
See you soon,.
Pedro
-
one-to-many selfjoin, delete records with the same rank or a substitution
Sorry for my poor choice of the title of the discussion, feel free to suggest me a more relevant
I rewrote for clarity and as a result of the FAQ post.
Version of DB
I use Oracle10g Enterprise 10.2.0.1.0 64-bit
Tables involved
CREATE TABLE wrhwr ( wr_id INTEGER PRIMARY KEY, eq_id VARCHAR2(50) NULL, date_completed DATE NULL, status VARCHAR2(20) NOT NULL, pmp_id VARCHAR2(20) NOT NULL, description VARCHAR2(20) NULL);
Examples of data
INSERT into wrhwr VALUES (1,'MI-EXT-0001',date'2013-07-16','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (2,'MI-EXT-0001',date'2013-07-01','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (3,'MI-EXT-0001',date'2013-06-15','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (4,'MI-EXT-0001',date'2013-06-25','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (5,'MI-EXT-0001',date'2013-04-14','Com','VER-EXC','Revisione') INSERT into wrhwr VALUES (6,'MI-EXT-0001',date'2013-04-30','Com','VER-EXC','Verifica') INSERT into wrhwr VALUES (7,'MI-EXT-0001',date'2013-03-14','Com','VER-EXC','Collaudo')
Query used
SELECT * FROM (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Verifica%') table1, (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Revisione%') table2, (SELECT eq_id, date_completed, RANK () OVER (PARTITION BY eq_id ORDER BY date_completed DESC NULLS LAST) rn FROM wrhwr WHERE status != 'S' AND pmp_id LIKE 'VER-EX%' AND description LIKE '%Collaudo%') table3 WHERE table1.eq_id = table3.eq_id AND table2.eq_id = table3.eq_id AND table1.eq_id = table2.eq_id
The above query is intended to selfjoin wrhwr table 3 times in order to have for each line:
- eq_id;
- date of the completion of a verification type work request for this eq_id (aka table1);
- date completion of a line (aka table2) type wr for this eq_id;
- date of completion of a type wr Collaudo (aka table3) for this eq_id;
A separate eq_id:
- can have different completion of many requests for work (wrhwr records) with dates or date of completion (date_completed NULL column).
- in a date range can have all types of wrhwr ('verification', 'Line', 'Problem'), or some of them (e.g. audit, line but not Collaudo, Collaudo but not verification and line, etc.);
- must not repeat the substrings in the description;
- (eq_id, date_completed) are not unique but (eq_id, date_completed, description, pmp_id) must be unique;
Expected results
Using data from the example above, I expect this output:
eq_id, table1.date_completed, table2.date_completed, table3.date_completed
MI-ext-001,2013-07-01,2013-07-16,2013-03-14 <- to this eq_id table3 doesn't have 3 lines but only 1. I would like to repeat the value most in the rankings in table 3 for each line of output
MI-ext-001,2013-07-01,2013-06-15,2013-03-14 <-I don't want this line of table1 and table2 with both 3 lines match must be in terms of grade (1st, 1st) (2nd, 2nd) (3rd, 3rd)
MI-ext-001,2013-06-25,2013-06-15,2013-03-14 <-2nd table1 joined the 2nd row from table2
MI-ext-001,2013-04-30,2013-04-14, 2013-03-14 <-1 table1, table2 rank rank 1, 1st rank table3
In the syntax of vector style, tuple expected output should be:
IX = ranking of the i - th of tableX
(i1, i2, i3) IF EXISTS a rank i - th line in each table
ON THE OTHER
(i1, b, b)
where b is the first available lower ranking of the table2, or NULL if there isn't any line of lower rank.
Clues?
With the query, I am unable to delete the lines "spurius.
I think a solution based on analytical functions such as LAG() and LEAD(), using ROLLUP() or CUBE(), using nested queries, but I would find a solution elegant, simple, fast, and easy to maintain.
Thank you
Hello
Sorry, it's still not quite clear what you are asking.
This becomes the desired resutls of the sample data you posted:
WITH got_r_type AS
(
SELECT eq_id, date_completed
CASE
Description WHEN LIKE '% Collaudo %' THEN 'C '.
Description WHEN AS 'Line %' THEN 'R '.
Description WHEN AS 'Verification %' THEN 'V '.
END AS r_type
OF wrhwr
Situation WHERE! = s "
AND pmp_id LIKE '% WORM - EX'
)
got_r_num AS
(
SELECT eq_id, date_completed, r_type
, ROW_NUMBER () OVER (PARTITION BY eq_id, r_type)
ORDER BY date_completed DESC NULLS LAST
) AS r_num
OF got_r_type
WHERE r_type IS NOT NULL
)
SELECT eq_id
LAST_VALUE (MIN (CASE WHEN r_type THEN date_completed END = ' V')
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS audit
LAST_VALUE (MIN (CASE WHEN r_type = 'R' THEN date_completed END)
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS line
LAST_VALUE (MIN (CASE WHEN r_type = 'C' THEN date_completed END)
IGNORES NULL VALUES
) OVER (PARTITION BY eq_id
ORDER BY r_num
) AS collauda
OF got_r_num
GROUP BY eq_id
r_num
ORDER BY eq_id
r_num
;
I guess the description can have (at most) only substrings target, in other words, you can't have a line like this:
INSERT into (1,'MI-EXT-0001',date'2013-07-16','Com','VER-EXC','Revisione VALUES wrhwr and audit");
In addition, you said the combination (eq_id, date_comepleted) is not unique, that it is y no example of this in your sample data. What results would you if, in addition to this line (who did the validation):
INSERT into wrhwr VALUES (7,'MI-EXT-0001',date'2013-03-14','Com','VER-EXC','Collaudo');
the following line is also?
INSERT into wrhwr VALUES (97,'MI-EXT-0001',date'2013-03-14','Com','VER-EXCFUBAR','Collaudo');
.
You could do a self-join instead of GROUP BY, but I suspect it will be much less effective. You can use FULL OUTER JOIN, since you do not know what r_types was that r_nums.
-
change the display based on data
Every time "ok" [keyword] appears, "BOLD" before it which date. Data are from a stream.
Example:
Today, March 23, 2010, it's ok.
Yesterday, January 2, 2009, ok.
Tomorrow will be held May 14, 2011, ok.Result: Today is March 23, 2010, ok.
Yesterday, January 2, 2009, ok.
Tomorrow will be held on May 14, 2011, ok.So far...
< CFSET #ReplaceNoCase(variable, "<ok.", "", "ALL") = variable # >
Since duration varies every time: find two points and two places before the key word and then "BOLD"Help please?
Have you tried the reReplaceNoCase tag? The ', \s*ok ' in the first parameter and the ', ok ' in the second parameter, handling the OK of your requirement.
-
How to upgrade the table based on data in multiple tables?
TABLE1:
=======
TXN_ID | NAME
--------------------
TX001 | null
TX002 | null
TX003 | null
TX004 | null
TX005 | null
TX006 | null
TX007 | null
TX008 | null
TX009 | null
TABLE2
========
TXN_ID
-------
TX002
TX004
TX005
TX006
TABLE 3
========
TXN_ID
-------
TX001
TX008
TX009
If TABLE1. TXN_ID present in TABLE2, I should update the form ABC TABLE1.NAME.
If TABLE1. TXN_ID present in table 3, I should update TABLE1.NAME as XYZ.
I can update this by running 2 scripts.
UPDATE TABLE1 SET B.SID = 'ABC' WHERE
IT EXISTS (SELECT 1 FROM TABLE2 B WHERE B.TXN_ID = A.TXN_ID);
UPDATE TABLE1 SET B.SID = "XYZ" WHERE
IT EXISTS (SELECT 1 FROM TABLE 3 C WHERE C.TXN_ID = A.TXN_ID);
How can we do this in a single script? I have more than 10 tables as TABLE2 and TABLE3.
Output should be:
TABLE1:
=======
TXN_ID | NAME
--------------------
TX001 | XYZ
TX002 | ABC
TX003 | null
TX004 | ABC
TX005 | ABC
TX006 | ABC
TX007 | null
TX008 | XYZ
TX009 | XYZ
Assuming a table2 and table3 will not have same tnx_id you can do.
merge into table1 t1
a_l'_aide_de)
Select txn_id
name
de)
Select txn_id, "TABLE2" name
from table2
Union of all the
Select txn_id, name "TABLE3."
table 3
)
) t2
on)
T1.txn_id = t2.txn_id
)
When matched then
set t1.name, t2.name = update
-
How to select the condition based on column A, but instead Act state based on column B
Sorry if the title of the discussion is not clear. I had some difficulty with a brief explanation/question.
I have a table as follows:
col1 | col2 . COL3
"sfg" | "hfd" | 5
"XXX" | "jhg | 3
"dfg" | "tyr" | 9
"XXX" | "lkh | null
I'm trying to
If col3 = null look col1 and select all items except where col1 = 'xxx '.
The result of select should look as follows:
col1 | col2 . COL3
"sfg" | "hfd" | 5
"dfg" | "tyr" | 9
How to do this? I tried with a grouping, group, on (partition by xxx)... It feels like I'm close, but I still do not find this one. You please give me a hint.
Just the way you are trying
[code]
SELECT col1, col2, col3
FROM (SELECT A.*, SUM (NVL2 (col3, 0, 1)) OVER (PARTITION BY col1) sm
FROM table_name A)
WHERE DMS = 0;
[/ code]
PS: The new layout of the oracle forums of hatred.
-
How to remove duplocate record when the condition is about 2 different columns
I have a table containing information of MySQL master-master relationship, look like that.
Now, I want to single related just look like that, (it sames as remove duplication of table replation)Master_node1 Master_node2 ---------- ---------- A1 A2 A2 A1 B1 B2 B2 B1
Could someone give me a tip how to do?Master1 Master2 ----------- ----------- A1 A2 B1 B2
Thanks in advance!
Best wishes
Satinewith t as ( select 'A1' c1, 'A2' c2 from dual union all select 'A2', 'A1' from dual union all select 'B1', 'B2' from dual union all select 'B2', 'B1' from dual union all select 'C1', 'C2' from dual union all select 'D2', 'D1' from dual ) select c1, c2 from ( select c1, c2, row_number() over( partition by substr(c1,1,1) order by c1) rno from t ) where level = 1 start with rno = 1 connect by nocycle c1 = prior c2
-
Is it possible to make the condition depending on the sql statements in the data models
Hi all
Is it possible to include the condition based on sql statements in the data models.
For example
Is something like this? Also, the good doc is available for ' how to take full advantage of the "data models" in BI Publisher?if (some parameter is not null) <sqlstatement name="STATEMENT_1"> ... </sqlstatement> else <sqlstatement name="STATEMENT_2"> ... </sqlstatement>
Thank you
-SookieHello Sookie,
I couldn't find the time to get a data model of demonstration of work for you, but I'll try to explain.First, write a PL/SQL package. Make sure that you set all the parameters of model of data such as a global variable in the default PL/SQL package.
CREATE OR REPLACE
package as employee
function BeforeReportTrigger return Boolean;
query_text varchar (2000);
number of p_DEPTNO;
END;
/CREATE OR REPLACE
package as body employee
function BeforeReportTrigger return Boolean IS
StartIF (p_DEPTNO = 10) THEN
query_text: = select col1, col2, col3 from HR.
elsif (p_DEPTNO = 20) THEN
query_text: = select col1, col2, col3 hr_history.
on the other
query_text: = select col1, col2, col3 hr_history1.
end if;
Returns true;
end;
/Use this package in the default package in your data model. Check the "defaultPackage ="employee"in the following data model header.
Sample data model
------------------------------
--
--
--
--
Before running the query SQL, data engine reads the "before the release of the report" and all the texte_requete argument based on the p_DeptNo value. When executing the Q1, engine sqlQuery analyze the query ' & quert_text and replace it with the actual value. For example if the p_deptno = 10, the query will be "select col1, col2, col3 from HR.
Try it...
-
Delete multiple records in the table...
Hello
I have a table with 720 000 records, I want to delete records for the date of joining i, e for 20/10/2008. To this date there 1065 records. can I use a simple delete for this statement?
Delete from Test where Join_date = 20 October 2008 ';
Is this is a good way to do it? Any suggestion splease.
Thank you!!Hello
user642297 wrote:
HelloI have a table with 720 000 records, I want to delete records for the date of joining i, e for 20/10/2008. To this date there 1065 records. can I use a simple delete for this statement?
Delete from Test where Join_date = 20 October 2008 ';
Is this is a good way to do it? Any suggestion splease.
Thank you!!
Yes, you can use statements like this to delete several lines at once.
Remember that all DATEs include a time. The statement you posted only deletes the lines dated at midnight (that is, 20 October 2008 00:00:00).
To remove all the same day, regardless of the time, sayWHERE Join_date >= TO_DATE ('20-oct-2008', 'dd-mon-yyyy') AND Join_date < TO_DATE ('21-oct-2008', 'dd-mon-yyyy')
If encoding time is more valuable than the run time, one could also say:
WHERE TRUNC (Join_date) = TO_DATE ('20-oct-2008', 'dd-mon-yyyy')
-
Dear experts,
Please help me understand how to delete records in the OPS.
Thank you!Hello
I doubt that the fetchrowcount = (int) vo.getFetchedRowCount; Returns 0.
Put a few s pon to check if his return more than 0.
Kind regards
GYAN -
Nested table of object type have only one record all the time
Hi all
I have a question regarding the storage of multiple records in a nested Table that is of type OBJECT.
The program below that I wrote for the test and during the test, I was able to store only the last record in the nested Table.
Please let me know what I did wrong here.
Step 1:
CREATE or REPLACE TYPE book_obj AS OBJECT (name varchar2 (25), author varchar2 (25), abstract varchar2 (4000));
/
Step 2:
CREATE or REPLACE TYPE book_table IS TABLE OF THE book_obj;
/
Step 3: CREATE TABLE book (name, varchar2 (25), varchar2 (25) author, varchar2 (4000)) abstract;
INSERT VALUES Accountants ('Harry Potter,' 'MK', 'It's magic');
INSERT the book VALUES ("Ramayana', 'VK', 'It is mythiology'");
COMMIT;
Step 4:
declare
bookset book_table;
ln_cnt pls_integer;
Start
bookset: = book_table (book_obj ('madhu', 'kongara', 'sudhan'));
dbms_output.put_line (' the number is ' | bookset.) (Count); -> I see COUNT = 1
bookset: = bookset_t(); -> Assignment to NULL.
dbms_output.put_line (' the number is ' | bookset.) (Count); -> I see County 0
for rec in (select * from book) loop-> now a loop twice.
dbms_output.put_line (' name > ' |) Rec.Name);
bookset: = bookset_t (book_t (rec.name, rec.author, rec.abstract));
end loop;
dbms_output.put_line (' the number is ' | bookset.) (Count); -> I can see COUNT = 1 (why?)
END;
I looped twice to fill two records in the TABLE IMBRIQUEE OF TYPE OBJECT. But when I see the Count I get only 1 and the data is also having the last record.
Can you get it someone please let me know how to fill out the table nested with all records. Tell me where I am wrong.
Very much appreciate your help here.
Thank you and best regards,
NKMMaldini says:
dbms_output.put_line (' the number is ' | bookset.) (Count); -->, I can see COUNT = 1 (why?)Because instead of add to bookset collectionto set (ergo replacement) it a collection containing recovered book. Use:
declare bookset book_table; ln_cnt pls_integer; begin bookset := book_table(book_obj('madhu','kongara','sudhan')); dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 bookset := book_table(); --> Assigning back to NULL. dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0 for rec in (select * from book) loop --> Now Looping two times. dbms_output.put_line(' name > '||rec.name); bookset.extend; bookset(bookset.count) := book_obj(rec.name, rec.author, rec.abstract); end loop; dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why) end; / The count is 1 The count is 0 name > Harry Potter name > Ramayana The count is 2 PL/SQL procedure successfully completed. SQL>
Or better use bulk collect:
declare bookset book_table; ln_cnt pls_integer; begin bookset := book_table(book_obj('madhu','kongara','sudhan')); dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 bookset := book_table(); --> Assigning back to NULL. dbms_output.put_line('The count is '||bookset.count); --> I can see count as 0 select book_obj(name,author,abstract) bulk collect into bookset from book; for i in 1..bookset.count loop --> Now Looping two times. dbms_output.put_line(' name > '||bookset(i).name); end loop; dbms_output.put_line('The count is '||bookset.count); --> I can see COUNT =1 (why) end; / The count is 1 The count is 0 name > Harry Potter name > Ramayana The count is 2 PL/SQL procedure successfully completed. SQL>
SY.
Maybe you are looking for
-
Firefox version 28.0 works in Windows 8.1?
I use Windows XP and I have the latest version of Firefox which is version 28.0. I want to buy a new computer, but I want to be able to use Firefox and all the addons I have. I saw a reference to Firefox 17 working in Windows 8.1 but not version 28.0
-
Satellite S3000 - X 4: upgrading the Bios?
Hello Please can you give me some advice on upgrading my bios for Toshiba Satellite S3000 - X 4. I have read all the instructions on this operation, but unfortunately this notebook is never come with a floppy drive, is there anyway that I can upgrade
-
The iphone 6 s there a tone to let me know that I have an incoming call while I talk on the phone
New for iphones. One of the things that miss me is a tone/tone, over the ear speaker, while I'm talking to someone to let me know I have an incoming call. Miss me calls important reason of not having something to let me know I have a call and need
-
(Redirected) DELL VOSTRO 1510 DISPLAY GOES DIM
It's been like that for a few years. When I connect on external monitor there is no problem at all. He often works when the external monitor is connected If I continue to use the FN + F8 change the choice between built-in-display + monitor, monitor,
-
Cannot download the English version of the iso file of windows 7...
I have a legal product key... Attempt to download iso file but only a language in the drop-down list is Korean... I need the English version