Counting rows with a particular value
Hello. I recently posted this thread Count java problem for how to count an attribute.
Now I need that count to be limited to a certain value inside the attribute.
let me clarify. I have a table Casinos, which is connected to a table SlotsInCasinos, which is further connected to SlotMachines in a many to many with SlotsInCasinos being the intersection.
The previous post that I mentioned (thanks Timo by the way) told me how to count all the slots in a particular casino.
Now I would like to know how I could count all the slots of a particular value (for example Poker slot Machines, regular Slot machines, etc) instead of the total count in a particular object.
So on the page I would have lets say 2 output texts, one showing the number of Poker Slot Machines in that particular casino and the other showing the number of regular Slot machines in that particular casino (a third could show the number of some third kind of slot machines).
Thank you for your time
Hello everyone here is an update
I created a view object called Test, based on the entity object SlotMachinesInCasino. I then created a view link TestLink and created a master detail relationship (the same one I already had for the View Object SlotMachinesCasinosVO.
The difference is in the query for test I put the following
SELECT
VezaTehOpTipAp.OBJEKAT_ID,
VezaTehOpTipAp.TIP_APARATA_ID,
VezaTehOpTipAp.VEZA_TEH_OP_TIP_AP_ID,
TIPOVI_APARATA.NAZIV_APARATA NAZIV_APARATA
FROM
VEZA_TEH_OP_TIP_AP VezaTehOpTipAp,
TIPOVI_APARATA
WHERE
TIPOVI_APARATA.NAZIV_APARATA = 'Evona'My thinking was that if I do this the estimated row count function for this will just give me the number of Evona Game machines. I tried it out in an SQL Worksheet and it gives back only the Evona machines.
Unfortunately when I create the TestIterator and then drop output text whose EL is the estimated row count for the test iterator it does not work as intended. It counts all the Slot Machines in the Object no matter the Name.
So it gives a number equal to all the slot machines instead of to the number of slot machines with name 'Evona'.
What did I do wrong?
Similar Messages
-
Updating row with a blob value
Hi, I get the following error when trying to update a row with a Blob value. I am using a Bfile as the external file ref. to put into the Blob.
ORA-22920: row containing the LOB value is not locked
The code that I'm using is the following:
PROCEDURE IOSYS_PCT.insert_blob AS
length NUMBER;
image BLOB;
image_file BFILE;
bf_dir VARCHAR2(40);
bf_name VARCHAR2(40);
BEGIN
SELECT temp_blob INTO image FROM temp_blob; /*initialise image with empty_blob()*/
SELECT image_sm, image_sm_file INTO image, image_file FROM images WHERE
file_id=1;
dbms_lob.filegetname(image_file,bf_dir,bf_name);
DBMS_LOB.FILEOPEN(image_file,DBMS_LOB.FILE_READONLY);
LOCK TABLE images IN ROW EXCLUSIVE MODE;
length := DBMS_LOB.GETLENGTH(image_file);
DBMS_LOB.LOADFROMFILE(image,image_file,DBMS_LOB.GETLENGTH(image_file));
DBMS_LOB.FILECLOSE(image_file);
UPDATE images SET image_sm = image WHERE file_id=1;
END;
Please help as I have ran out of ideas what could be wrong.
Thanx Andre
nullHi, I get the following error when trying to update a row with a Blob value. I am using a Bfile as the external file ref. to put into the Blob.
ORA-22920: row containing the LOB value is not locked
The code that I'm using is the following:
PROCEDURE IOSYS_PCT.insert_blob AS
length NUMBER;
image BLOB;
image_file BFILE;
bf_dir VARCHAR2(40);
bf_name VARCHAR2(40);
BEGIN
SELECT temp_blob INTO image FROM temp_blob; /*initialise image with empty_blob()*/
SELECT image_sm, image_sm_file INTO image, image_file FROM images WHERE
file_id=1;
dbms_lob.filegetname(image_file,bf_dir,bf_name);
DBMS_LOB.FILEOPEN(image_file,DBMS_LOB.FILE_READONLY);
LOCK TABLE images IN ROW EXCLUSIVE MODE;
length := DBMS_LOB.GETLENGTH(image_file);
DBMS_LOB.LOADFROMFILE(image,image_file,DBMS_LOB.GETLENGTH(image_file));
DBMS_LOB.FILECLOSE(image_file);
UPDATE images SET image_sm = image WHERE file_id=1;
END;
Please help as I have ran out of ideas what could be wrong.
Thanx Andre
null -
How can I replace column value with a particular value in SQL
Hi All,
Can anyone please tell me how can I format my output with replacing a column value with a specific value which actually depends on the present value of the column
I am executing the following SQL statement
select state,count(id) from <table_name> where composite_dn= <composite_dn_name> group by state;
My Present output is:
State No.Of Instance
1 3
3 28
I want to replace the value in the column state as follows
State No.OfInstances
Completed 3
Faulted 28
I want "1" to be reppaced by "Completed" and "3" to be replaced by "Faulted"
Is is possible with SQL or PL/SQL , if it is then how can I achieve this required result. Please help!!
Thanks in Advance!!
Edited by: Roshni Shankar on Oct 27, 2012 12:38 AMHi Roshni,
I guess this CASE clause can be simulated by a DECODE and also it is very easy to use.
Refer -- http://www.techonthenet.com/oracle/functions/decode.php
select decode(t1.state,t2.state_id,t2.state_name), t1.count_id
from <table_2> t2, (select state,count(id) count_id
from <table_name>
where composite_dn= <composite_dn_name>
group by state) t1
where t1.state = t2.state_id;HTH
Ranit B.
Edited by: ranit B on Oct 27, 2012 2:02 PM
-- link added
Edited by: ranit B on Oct 27, 2012 2:19 PM
-- sample code added -
SQL Developer 2.1 EA - count rows with filter on a table
This is a small problem that I came across today while using 2.1 EA. I opened a table and did a filter to narrow down the results of the table. Then when I right clicked on the search results and clicked on 'Count Rows'....I get the count of the rows in the table and not my search results.
Is this a feature or a bug?
Thanks,
MikeIn EA2, we get both the total and the filtered total, nice.
Only remark is we don't get a progress indicator anymore, and thus can't cancel a query that might take up hours to finish!
Please log a bug for this.
Thanks,
K. -
Counting rows with multiple criteria
I know this is a silly beginner question, but is there an easy way to count the number of rows in a table which match criteria based on different columns (sort of a countif with multiple criteria). For example, if Column A in a table has "All, Some, None" responses and Column B has "Main, Off" responses, is there an easy way to count the number of rows in which Column A has All and Column B has Off?
Neondiet wrote:
From an intellectual and philosophical view I agree with you. But from a practical view what I really want to do is just use one application for my spreadsheet tasks, not jump back and forth because one sheet I share with MS Windows users, and another with Numbers users, and another with OS X users who don't have Numbers or Excel but do have NeoOffice. Maybe I have to settle for that though.
Yeah... this kind of situation stinks. Its like needing to writing software that will run on both Macs and PCs.
Anyway, I've followed the advise in this forum and resorted to using a hidden column with concatenated values to solve my own problem, though it does seem like a bit of a hack compared to managing a single formula in a single cell. Horses for courses I suppose.
jaxjason has posted a very elegant pivot table like solution that utilizes this technique. See http://www.numberstemplates.com/forums/showthread.php?t=36
Btw, from what I've read on the net to date, SUM (in Excel) with an array formula answers the original authors problem of counting occurrences of values, not SUMPRODUCT; which I believe sums up the contents of cells in a range, if cells in other ranges match specific criteria.
Yes, if you use the '*' (as indicated above) then SUM() is sufficient though SUMPRODUCT() will work as it degenerates to SUM when there is only one argument. If you use two arrays as arguments (like: = SUMPRODUCT((A1:A4="All"), (B1:B4="Off")), then SUMPRODUCT() is necessary. Here's my understanding of how it works (I hope your able to follow my abuse of algebraic techniques):
=SUM((A1:A4="All") * (B1:B4="Off"))
expanding the array expressions...
=SUM((A1="All", A2="All", A3="All", A4="All") * (B1="Off", B2="Off", B3="Off", B4="Off"))
at this point Excel computes the equality expressions, for example...
=SUM((TRUE, FALSE, TRUE, FALSE) * (TRUE, TRUE, FALSE, FALSE))
expanding the array multiplication...
=SUM((TRUE * TRUE, FALSE * TRUE, TRUE * FALSE, FALSE * FALSE))
Excel, apparently, then, when forced to multiply Boolean values, maps TRUE -> 1 and FALSE -> 0...
=SUM((1 * 1, 0 * 1, 1 * 0, 0 * 0))
performing the multiplications...
=SUM((1, 0, 0, 0))
summing...
=1 + 0 + 0 + 0
resulting...
=1
I'm afraid, now, if I continue any further, Yvan will chastise me. -
List rows with a certain value from a different table?
Hi,
I'm trying to list certain rows from a different table. Similar to the filter feature, kind of like a report.
To be specific, I have 12 tables (Jan-Dec) with many entries each (as rows). Each row has a date, text and further data. Now I want to create an additional table that lists rows from the other tables that have a certain date.
I would like to just enter that date in a header row cell so I can make a quick query. Using LOOKUP only shows the first row of that date. Is that even possible?Hi papalapapp,
If you don't mind using a script, you're using Numbers 3, and all of your monthly tables are on the same sheet, then you could do something like this:
Copy-paste script to Script Editor
Enter date you want to filter on in the designated filterCell (here A1 of the Extract table). Make sure it is formatted exactly like the dates in the monthly tables.
Clear any existing values from the Extract table, and make sure there are enough blank rows.
Click the run button in Script Editor.
SG
property targetTable : "Extract"
property filterCell : "A1"
tell application "Numbers"
tell document 1's active sheet
set dateFilter to table targetTable's cell filterCell's formatted value
--get all data in tables (excluding Extract table)
set vv to {}
repeat with t in tables
if t's name is not targetTable then
set vv to vv & t's rows's cells's formatted value
end if
end repeat
--filter data
set vvFilt to {}
repeat with i from 1 to vv's length
if vv's item i's item 1 is dateFilter then
set vvFilt to vvFilt & {vv's item i}
end if
end repeat
--write filtered data to table
tell table targetTable
repeat with r from 1 to (vvFilt's length)
repeat with c from 1 to vvFilt's item 1's length
set row (r + 1)'s cell c's value to vvFilt's item r's item c
end repeat
end repeat
end tell
end tell
end tell -
How to identfy rows with same column value
Hi
I have a table student
id ( pkey)
name
class
marks
i need to check the existence of duplicate values like
say the values are :
id name class marks
1 alan 6 85
2 victor 4 97
3 alan 6 85
i need to know if there is any matching row in the table --- like in this case id=1 and id=3 have same value for all the columns except for id .
so the result shud tell me the ids which have duplicate values for name , class , marks and also those ids for which there is no duplicacy
for id= 1 i see that id= 3 has same values
and id=2 has no duplicates
how do i show it ??
The result i expect is
name class marks count
alan 6 85 2
victor 4 97 1
Message was edited by:
SHUBHEMP
id name class marks
1 alan 6 85
2 victor 4 97
3 alan 6 85
You can use a self join to pull out the data which are almost duplicate without a column values here in this example without id the first and third records are duplicate.
select e.id,e.name,e.class,e.marks from EMP e,EMP d where e.name=d.ename and e.class=d.class and e.marks=d.marks and e.id<>d.id; -
Bug: when fetching arrays of rows with null data values
Using Oracle ODBC Driver 8.01.73.00 or 8.01.74.00 (called
8.1.7.3.0 and 8.1.7.4.0 on the Oracle downloads page).
When fetching multiple rows, and where some of the data is null,
the the indicator variable quite often (but not always) has
incorrect values.
Is this a known bug? This seems like something that lots of
people would encounter so I find it hard to understand why it
hasn't already been fixed.
Also, how do I report this as a bug to Oracle? I couldn't find
the place on the site to do this.
To reproduce:
Create the following data in Oracle
create table null_test
item_id number (10, 0) not null,
data1 number (10, 0) null,
constraint null_test_pk1 primary key (item_id)
insert into null_test (item_id) values (1);
insert into null_test (item_id) values (2);
commit;
When you run the code to print out indicators and values, you
get this output
4: 1 -1:
4: 2 0:-858993460
The code to do this is as follows (put in your own values for
the #defines at the top)
#include <windows.h>
#include <sql.h>
#include <sqlext.h>
#include <stdio.h>
#define DB_NAME ""
#define USER_NAME ""
#define PASSWORD ""
#define TEST_RETVAL(R) if (R != SQL_SUCCESS && R !=
SQL_SUCCESS_WITH_INFO) return 1;
int main()
SQLRETURN retval;
SQLHENV henv;
retval = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE,
&henv);
TEST_RETVAL(retval);
retval = SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION,
(void*)SQL_OV_ODBC3, 0);
TEST_RETVAL(retval);
SQLHDBC hdbc;
retval = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
TEST_RETVAL(retval);
retval = SQLConnect(hdbc, (unsigned char*)DB_NAME,
SQL_NTS, (unsigned char*)USER_NAME, SQL_NTS, (unsigned char*)
PASSWORD, SQL_NTS);
TEST_RETVAL(retval);
SQLHSTMT hstmt;
retval = SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
TEST_RETVAL(retval);
const char* Query = "select item_id, data1 from
null_test order by item_id";
const int NumRows = 13;
int NumRowsFetched;
retval = SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_BIND_TYPE,
SQL_BIND_BY_COLUMN, 0);
TEST_RETVAL(retval);
retval = SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_ARRAY_SIZE,
(void*)NumRows, 0);
TEST_RETVAL(retval);
retval = SQLSetStmtAttr(hstmt,
SQL_ATTR_ROWS_FETCHED_PTR, &NumRowsFetched, 0);
TEST_RETVAL(retval);
SQLINTEGER rgnItemId[NumRows], rgnData1[NumRows],
rgnData2[NumRows];
SQLINTEGER rgnItemIdInd[NumRows], rgnData1Ind[NumRows],
rgnData2Ind[NumRows];
retval = SQLBindCol(hstmt, 1, SQL_C_LONG, rgnItemId, 0,
rgnItemIdInd);
TEST_RETVAL(retval);
retval = SQLBindCol(hstmt, 2, SQL_C_LONG, rgnData1, 0,
rgnData1Ind);
TEST_RETVAL(retval);
retval = SQLExecDirect(hstmt, (unsigned char*)Query,
SQL_NTS);
TEST_RETVAL(retval);
for (int i = 0; i < NumRows; i++)
rgnData1Ind[i] = rgnItemIdInd[i] = rgnData2Ind
= 0;
while ((retval = SQLFetchScroll(hstmt, SQL_FETCH_NEXT,
0)) != SQL_NO_DATA)
TEST_RETVAL(retval);
for (int i = 0; i < NumRowsFetched; i++)
if (rgnData1Ind[i] == SQL_NULL_DATA)
printf("%2d:%5d %2d:%6s\n",
rgnItemIdInd[i], rgnItemId[i], rgnData1Ind[i], "", rgnData2Ind
[i], rgnData2[i]);
else
printf("%2d:%5d %2d:%6d\n",
rgnItemIdInd[i], rgnItemId[i], rgnData1Ind[i], rgnData1[i],
rgnData2Ind[i], rgnData2[i]);
for (i = 0; i < NumRows; i++)
rgnData1Ind[i] = rgnItemIdInd[i] =
rgnData2Ind[i] = 0;
retval = SQLCloseCursor(hstmt);
TEST_RETVAL(retval);
retval = SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
TEST_RETVAL(retval);
retval = SQLDisconnect(hdbc);
TEST_RETVAL(retval);
retval = SQLFreeHandle(SQL_HANDLE_DBC, hdbc);
TEST_RETVAL(retval);
retval = SQLFreeHandle(SQL_HANDLE_ENV, henv);
TEST_RETVAL(retval);
return 0;We get this problem too. We do a large fetch (200K rows)and find
that not only do the null indicators report incorrectly, but the
data for the nullable column is corrupt as well. -
How to search for a text node with a particular value in an xml document with labview
supposing i have the following xml document:
<head>
<book>
<bookname>zio</bookname>
<author>dan</author>
</book>
<book>
<bookname>the spear warrior</bookname>
<author>britney</author>
</book>
<book>
<bookname>the beard</bookname>
<author>derrick</author>
</book>
</head>
i want to search for the author of the book "the beard" using for example the V.I Get first match of labview to access the the node with value "the beard" and then use Get next sibling V.I and Get node text content to get get the author of this book..so my question is how do i write the xpath expression for Get first match so as to access the node with bookname "the beard" instantyly? am trying to minimise the use of loops because they increase the time duration,..thank you (NB:i dont want to use Get all Matched V.I because it obliges me to use a loop in order to access the name derrick and this increases the time duration for my v.i)
Solved!
Go to Solution.Since it's all text, why not use a real quick Match Pattern (or Regular Expression, but you don't need that much power here), see attached.
Cameron
To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.
To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):
LabVIEW Unit 1 - Getting Started
Learn to Use LabVIEW with MyDAQ
Attachments:
Two-stage match demo.vi 8 KB -
How to select rows with duplicate column values
hi,
i have a table property_details which has these 2 columns customerno and propertyno a customer can have many properties and property number has to be unique. but somehow these property number has been duplicated at an earlier stage so i have for a customer with many properties the same property number
how i will select such records whose asset numbers are the same
for ex
customer no property no
a1300 1
a1300 1
a1300 1
a2330 10
a2330 10
a2330 10
kindly suggest me a solutionthis example might be of help.
SQL> select * from employees;
YEAR EM NAME PO
2001 02 Scott 91
2001 02 Scott 01
2001 02 Scott 07
2001 03 Tom 81
2001 03 Tom 84
2001 03 Tom 87
6 rows selected.
SQL> select year, empcode, name, position,
2 row_number() over (partition by year, empcode, name
3 order by year, empcode, name, position) as rn
4 from employees;
YEAR EM NAME PO RN
2001 02 Scott 01 1
2001 02 Scott 07 2
2001 02 Scott 91 3
2001 03 Tom 81 1
2001 03 Tom 84 2
2001 03 Tom 87 3
6 rows selected.
SQL> Select year, empcode, name, position
2 From (Select year, empcode, name, position,
3 row_number() over (partition by year, empcode, name
4 order by year, empcode, name, position) as rn
5 From employees) emp
6 Where rn = 1;
YEAR EM NAME PO
2001 02 Scott 01
2001 03 Tom 81
SQL> -
Hello,
We are creating a cross tab report, with products as the columns, and relationship managers with direct and shared revenue displayed across the rows.
For Eg
Relationship Manager Coverage Product1 Product2 Product3 Product4
Bob Direct 100, 0, 35, 50
Shared 0, 0, 15, 0
Alex Direct 15, 25, 40, 10
Shared 5, 0, 5, 0
George Direct 0, 0, 0, 30
Shared 0, 0, 0, 5
The problem lies when either one of the products has no values, or one of the relationship managers has no direct or shared revenues. If one of the products has no revenues, it disappears, and also when one of the RMs has no direct or shared revenues, the Direct or Shared row disappears.
I have tried to create a second query just included the Coverage variable, and using this variable in Query 2 with the RM variable from query 1, along with checking the "Show Rows with Empty Measure values", "Show Rows with Empty Dimension Values" and "Show when empty", but it still does not appear to work.
It only shows rows with values in them, and shows the rows with empty values at the end with no RM.
I have not tried to solve for empty columns yet.
Help with this would be much appreciated!!!!!!!!
Thank youHi ,
I think you can resolve this issue following ways ,
you need create another query ( Ex :Qauery2 ) add Product object and RM (Direct,shared) object only without conation. So now query2 result wil have all product and RM(Direct,shared).
Merge the Product object and RM between query1 and query2
Now create table using Product and RM from query2 and measure value from query1. Now you will get row even there is no data.
If you want try this sample report using efasion unvierse.
1) Add year ,state and Discount objects and apply condition Year Not in list "2004" and state Not in list "California "
2) run this query and create the cross tab table . Now you will not get 2004 column and California row in table.
3) Create query2 add Year and State only without any condition , run the query. Now query 2 will display all state and year .
4) Merge the column Year and State between query1 and query2
4) Create the cross table ussing Year and state from query2 and Discount from Query1
Now cross table will show 2004 and California ,even there is not in query 1.
I hope this will help you.
Ponnarasu
Edited by: ponnarasuk on Dec 7, 2011 12:48 PM -
Problem in summation on a column with possible null values
Hi,
I want to do summation on a column.
If I use <?sum(amount)?>, if there is any null value,its giving NaN as output.
From the forum I got the below syntax
<?sum(AMOUNT[number(.)!='NaN'])?>
but it is also not giving me the expected result. Its always displays 0.
I want some thing like sum(NVL(amount,0)). Could some body please help me out?
Thanks in Advance,
ThiruIf the column has many, many null values, and you want to use the index to identify the rows with non-null values, this is a good thing, as a B*Tree index will not index the nulls at all, so, even though your table may be very large, with many millions of rows, this index will be small and efficient, cause it will only contain index entries for those rows where the column is not null.
Hope that helps,
-Mark -
Display a column as row with same row names.
Hi,
My belwo query displaying o/p in this format.I need to conver a row with appriate colmn value (see the required o/p).
could some help.
current o/p
TEST_SESSION_ID ROSTER_DOMAIN_NAME TO_CHAR(A.SCORE) SEM
4087 AR - Integers and Fractions 5.148757270620481 1
4087 AR - Decimal Numbers 5.5597596042656825 2required o/p format
TEST_SESSION_ID AR - Integers and Fractions AR - Decimal Numbers sem-AR - sem
Integers and Fractions AR - Decimal Numbers
4087 5.148757270620481 5.5597596042656825 1 2ROSTER_DOMAIN_NAME are not staticks.I tcould be increase .some times it could have 20 names.Since i can t use decode or case with statically .can some one help on this.
query
SELECT a.test_session_id,c.roster_domain_name,to_char(a.score),a.sem FROM
test_session_detail a,test_session b ,test_detail c
WHERE a.test_session_id = b.test_session_id
AND c.test_detail_id = a.test_detail_id
AND exists (
select td.test_detail_id
from test_detail td
where domain_map_id is not null
and c.test_detail_id =td.test_detail_id
and domain_map_id in('303','306','305','304'))
AND b.test_session_id in ('4087')
AND domain_group_id NOT IN (
SELECT domain_group_id
FROM test_session_detail a,test_session b
WHERE a.test_session_id = b.test_session_id
AND a.domain_group_id is not null
AND b.test_session_status_id = 4
AND a.test_session_status_id <> 3
AND b.test_session_id IN ('4087'))Ok, the problem here is that you want a dynamic pivot of data and you also want to use some of the data as the column names.
SQL requires that the columns to be retrieved are known at query parse time, i.e. before any data is fetched, so it's not easily possible to have dynamic column names done in a single query.
The general steps in executing a query are...
1. Submit SQL query (Open Query)
2. SQL Query Parsed
3. SQL Query Executed
4. Row Fetched
5. Repeat step 4 until no more rows
6. Close QuerySo, as you can see no data is fetched until step 4, but, at Step 2, the SQL engine needs to have parsed the query and already know what columns and data types are going to be returned.
An example of how something similar can be achieved is given on this thread:
How to pipeline a function with a dynamic number of columns?
But that may be a little too complex to implement.
What you are really wanting is something at the front end reporting side of things.
Ideally, this is the task of a reporting tool, not of the SQL engine which is retrieving the data. -
Update rows with a sequence which fall under same group.
Hi Friends,
I have sample table with following data :
ID DIV NEW_ID
1 A
2 A
3 B
4 B I want to update the column NEW_ID with a sequence value for the rows with same DIV value.
My result should look like below :
ID DIV NEW_ID
1 A 1001
2 A 1001
3 B 1002
4 B 1002How can I accomplish with a single update ?
Thanks
Raj.This isn't pretty, but it should work ....
ME_XE?create table table1 (col1 number, col2 varchar2(1), col3 number);
Table created.
Elapsed: 00:00:00.04
ME_XE?insert into table1 values (1, 'A', NULL);
1 row created.
Elapsed: 00:00:00.06
ME_XE?insert into table1 values (2, 'A', NULL);
1 row created.
Elapsed: 00:00:00.01
ME_XE?insert into table1 values (3, 'B', NULL);
1 row created.
Elapsed: 00:00:00.00
ME_XE?insert into table1 values (4, 'B', NULL);
1 row created.
Elapsed: 00:00:00.00
ME_XE?
ME_XE?
ME_XE?create sequence s start with 1001 increment by 1;
Sequence created.
Elapsed: 00:00:00.00
ME_XE?create or replace function get_s_nextval
2 return number
3 as
4 o_val number;
5 begin
6 select s.nextval into o_val from dual;
7 return o_val;
8 end;
9 /
Function created.
Elapsed: 00:00:00.54
ME_XE?
ME_XE?
ME_XE?merge into table1 t using
2 (
3 with data
4 as
5 (
6 select --+ MATERIALIZE
7 col2, get_s_nextval as next_value
8 from
9 (
10 select distinct col2
11 from table1
12 where col3 is null
13 )
14 )
15 select * from data
16 ) s
17 on (s.col2 = t.col2)
18 when matched then update set t.col3 = s.next_value;
4 rows merged.
Elapsed: 00:00:00.20
ME_XE?
ME_XE?
ME_XE?select * from table1;
COL1 COL COL3
1 A 1001
2 A 1001
3 B 1002
4 B 1002
4 rows selected.
Elapsed: 00:00:00.03
ME_XE? -
Getting Chained Rows with SQL-Loader
Hi, I'm getting chained rows when loading data into an empty table. I always thought this could only happen when updating rows in a table. I'm loading into a datawarehouse, so I set the pctfree and pctused to use as much of the data blocks as possible. Here's the specs:
pctfree 5, pctused 90 (blocksize 8k).
The average rowsize is 1481 bytes.
There will never be updates or deletes on this table. The table is always created new or truncated. How come does Oracle chain about 30 percent of the rows with the above values? I had to go down to pctfree 50 in order to get chained rows = 0.
tia,
Danny Smith- check if your table has check constraints (like column not null)
if you trust the data in the file you have to load you can disable this constrainst and after the loader enable this constrainst.
- Check if you can modify the table and place it in nologging mode (generate less redo but ONLY is SOME Conditions)
Hope it helps
Rui Madaleno
Maybe you are looking for
-
I need to update! Please help!!
Ok, I am really having trouble here and am very frustrated. I have an eMac still on 10.2.8. This being my first computer, I didn't realize how important it is to do the updates and now I feel totally stuck. I got the Tiger update CD, but it won't ins
-
When launch nokia lumia 620???? What is price nokia lumia 620???? in which month nokia lumia 620 launch??? Attachments: Nokia-Lumia-620-2.jpg 26 KB
-
Trouble compiling java files inside the packages.
Hello I have a question in Java when compiling with packages. Can anyone Help?? My 2 java files BeerSelect2.java & BeerExpert.java are in packages com.example.web & com.example.model respectively. C:\MyProjects\beerV1\src\com\example\web\BeerSelect2.
-
Site made with iWeb using personal domain name
I have created a web site on iWeb 08 and have a personal domain name through Network Solutions. The website was published to Mobile Me after "set up personal domain" was done. The C Name record was changed at Network Solutions to web.me.com. When I w
-
Dms : Error using SAP-SYSTEM Storage Category
hi guys , i have some issue related to checkin document . while i am checkin a document using storage category KPRO ,the document is getting stored but when i use SAP-SYSTEM the Document is not getting stored I have used the BAPI CVAPI_DOC_CHECKI