Select the table column group and generate a sequence number
I have to select data from a table column group and generate a sequence for every reset of the sequence from 1 to leave.For example:
Data:
Col1 Col2 Col3 Col4
A NA KA-2009-08-13
B NA KA-2009-08-13
C NA KA-2009-08-13
A NA KA-2009-08-13
B NA KA-2009-08-13
A NA KA-2009-08-13
Expected results of the Select statement:
Col1 Col2 Col3 Col4 Seq_No
A NA KA-2009-08-13 1
A NA KA-2009-08-13 2
A NA KA-2009-08-13 3
B NA KA-2009-08-13 1
B NA KA-2009-08-13 2
C NA KA-2009-08-13 1
How can it be possible with a SELECT statement? Is it possible to assign the following numbers for a group of columns and put it back when it changes? In the above example, all columns are the key to generate the seq number
I know that this can be done using procedures stored and that is how I do it now by introducing a temporary table.
Can someone help me with this? Please let me know if the question is too vague to understand!
Thank you
Nachi
Use the row_number() analytics.
Ravi Kumar
Tags: Database
Similar Questions
-
I have two columns of text created with tabs. I want to select the first column without selecting the second column (I want to format the first column differently). Hope it would be possible to drag a marquee on it and have it select but apparently not. Will do it line by line, but for later use, would like to know if there is a way.
David
Creates the tabbed table text would allow you to do. It will give you much more control over the formatting as well.
To change the text tabs in a table, select the text with tabs and choose table > convert text to table.
-
How to disable the right click option resize on the table column header?
Hi all
Please let us know how to disable the right click option resize on the table column header.
The problem is that when I right click on the header of the column, the column is selected and the context menu with options like type, resize columns, columns, etc... is popping. We want to disable the option of re-size column.
We create a link by program the values in the table (do not use Bc4J) and the version of Jdeveloper's 11.1.2.2
Thanks in advance,
-Vignesh S.
So who did not observe here is that the table is wrapped in a panelCollection and who is in fact source menu. However, the content of the context menu can be controlled through the featuresOff of the panelCollection component attribute
-
How to get the names of the table columns in the quick dashboard
How to get the names of the table columns in the quick dashboard
Thanks and greetings
------------------------
Kishore PMake a prompt like:
SELECT case when 1 = 0 then 'D0 time. " "" T02 by month name "other" 'D2 market' '. "" M04 region' ' the end 'Sample Sales' UNION ALL SELECT case when 1 = 0 then 'D0 Time. " "" T02 by month name ' else ' 'Time D0. "" T02 by month name ' ' the end 'Sample Sales.
Put the name of column in single quotes.
Make your rank as a function:
Rank ('F1 income'. "" Recipes 1-01 (after all) "by @{pColumn} {'D0 time'. ({"" T05 annually name '})It works fine for me
concerning
John
http://obiee101.blogspot.com
-
How to insert image from mysql into the table using php and create the checkbox in the table?
How can I insert image from mysql into the table using php and create the checkbox for each data as a vote? Here is my code...
WELCOME
If you have saved the file name in the database, it's pretty simple.
echo '';
Is the same for the box:
echo '';
If you have saved the image file in the database, it is much more complicated. I recommend you store only the file name in the database.
-
Select the tables to Jdeveloper (master / detail)
Hi, I need to add tables in Jdeveloper, the conecction to the database is allowed. But my problem is that I Don t know to select the tables and details of how master-.
Thank you, the Colombia.you use what version of JDeveloper. ? If 11g, check this blog:
http://andrejusb.blogspot.com/2009/03/ADF-faces-rich-client-popup-and-master.html
concerning
-
Who holds the keys for encryption AES mentioned in the table under "security and features iCloud?
Article
Security and privacy - Apple Support Overview iCloud
has a useful table in the section entitled Security and features iCloud.
The table shows the types of keys used to secure the different types of data.
Apple holds these keys as it may be requested of Apple by third parties?
Hmmm... You definitely raise a good and valid question to which I don't know the answer to, but if I had to guess, I would say that no one. Would this be possible? I know I've heard Cook mention that they "don't hold the keys" but does the same thing, it refers? It would make a very interesting topic of discussion.
-
difference in size of the Table in oracle and timesten
Hi all
I have a large table with 2 million records,
I see no big difference in the size of the table in oracle and Timesten
In oracle table size to 4 GB, but in Timesten is arround 15 GB (using ttSize for 2 M lines)
Could you please tell me what could be the cause of this difference?
Is the size of the table in Timesten is always more than oracle?
What are the factors and parameters affecting the size of Perm?It is typical for the storage needs for a DataSet to be significantly larger in TimesTen in Oracle. This is due to the Organization of the very different internal storage in TT from Oracle; Oracle is optimized to save space while TT is optimized for performance.
Ways to minimize these costs are:
1. make sure you use TimesTen 11.2.1. This has some characteristics compare compact (minor) and earlier versions.
2 assess the use of numeric types; native types TimesTen (TT_TINYINT, TT_SMALLINT, TT_INTEGER and TT_BIGINT) use less space than MANY and longer by the effective calculation as well.
3. check use of data of variable length (VARCHAR2, VARBINARY, NVARCHAR) and the trade-offs between online and online storage (see documentation for the compromise between these options stirage TT).
Even when you use the foregoing, you will still see a storage important "inflation" for TT from Oracle.
Chris
-
problems with the table of contents and index
I do the localization for the Japan, so I'm all nice and good in Japanese (themes, table of contents and index), however, after compilation, only the TOC and India are in a font that does not support Japanese characters.
Does anyone have any ideas how to solve this problem?
Thank youThank you Pete, it's part of the solution.
In fact, what I discovered on a German forum for RoboHelp, is to set the machine to the locale for the country, and the location is made. I installed the language support pack before my problem and so I was able I was translating into topics. The problem appeared when I tried my first compilation. The subjects were still in Japanese, that I translated, but the table of contents and the index and were the only ones who wrote in a totally unknown style (not Japanese English and not another language, I know).
Now that I've changed the location of my system, it works.
So, I think that this should be a first improvement for RoboHelp, right? They boast that they support 35 languages, however the support isn't quite... finish, huh?
Furthermore, the error message continues to come even after all these changes, but I don't like too much about this, I get what I need.
Thanks again Pete for the solution and the quick response. -
Table of functions and direct requests for NUMBER data types database
Hello. I call a number of functions table of our Enterprise BI server, and I chose to do this by using direct database requests (I believe you can also call functions table in the physical layer of the repository, but is not what I do). The problem is that whenever I go back any number of the table function which is not a whole number (1.23, for example), BI assigns the INTEGER data type to the field rather than the data type DOUBLE, rounded so my number to the nearest integer. Here is a short example:
Create these 3 database objects:
CREATE or REPLACE TYPE my_row AS OBJECT (my_num NUMBER);
CREATE or REPLACE TYPE my_tab AS TABLE OF THE my_row;
FUNCTION to CREATE or REPLACE my_table_function RETURN my_tab
PIPELINED IS
BEGIN
PIPE ROW (my_row (1.23));
END;
/
Make this your request at your request Direct to database:
SELECT my_num FROM table (my_table_function);
This query returns correctly '1.23' when it is called from the database. In BI, on the other hand, it returns a value of '1' (and the field of labels an INTEGER rather than data type DOUBLE). If at the request of data Direct you change column properties-> data-> decimal from 0 to 2 Format, then it displays is not surprising "1.00". I then tried to change MY_ROW. Data type of MY_NUM by explicitly specifying the precision and no luck. BI still labels this field as an INTEGER. Then I started to try to deceive BI massaging the SQL statement itself. None of the following worked:
SELECT to_number (my_num) as my_num2 FROM table (my_table_function);
SELECT my_num2 + 0.01 as my_num3 FROM (SELECT my_num - 0.01 AS my_num2 FROM table (my_table_function));
SELECT to_number (to_char (my_num)) as my_num2 FROM table (my_table_function);
SELECT to_number (substr (to_char ('x' | my_num), 2)) as my_num2 FROM table (my_table_function);
Now, I found a solution, but I'm surprised that I have to resort to that:
SELECT * FROM (SELECT / * + NO_MERGE * / table my_num (my_table_function));
Is anyone out there knows a better way to do it? The above is a hack in my opinion. :)
Thanks in advance for any input.
-JimYes, it's really amazing.
But I got it.CREATE OR REPLACE TYPE my_row AS OBJECT (my_num NUMBER(10,2));
and in your SQL:
SELECT cast(my_num as double precision) as my_num2 FROM table(my_table_function);
I have the good result and I see the numbers after the decimal point.
Very delicate!Published by: gerardnico on July 7, 2009 14:55 change number (10.2) in double precision... pffff
-
Hello
I am train to write a procedure where I would spend the table as a parameter name and then the code would determine it is column names, and then he would insert records in each column depending on the data type. could someone help me with this.
Thank you
SM
Hello
Perhaps you need to dummy data just for the table.
Here is my exercise
create or replace procedure generate_rows(p_table_name varchar2, p_count number) is -- function insert_statement(p_table_name varchar2) return clob is l_columns clob; l_expressions clob; l_sql clob default 'insert into p_table_name (l_columns) select l_expressions from dual connect by level <= :p_count'; begin select -- l_columns listagg(lower(column_name), ',') within group (order by column_id), -- l_expressions listagg( case when data_type = 'DATE' then 'sysdate' when data_type like 'TIMESTAMP%' then 'systimestamp' when data_type = 'NUMBER' then replace('dbms_random.value(1,max)', 'max', nvl(data_precision - data_scale, data_length) ) when data_type = 'VARCHAR2' then replace(q'|dbms_random.string('a',data_length)|', 'data_length', data_length ) else 'NULL' end, ',') within group (order by column_id) into l_columns, l_expressions from user_tab_columns where table_name = upper(p_table_name); -- l_sql := replace(replace(replace(l_sql, 'p_table_name', p_table_name), 'l_columns', l_columns), 'l_expressions', l_expressions); -- debug dbms_output.put_line(l_sql); -- return l_sql; end; begin execute immediate insert_statement(p_table_name) using p_count; end; / -- test create table mytable( id number(4,0), txt varchar2(10), tstz timestamp with time zone, dt date, xml clob ) ; set serveroutput on exec generate_rows('mytable', 10); select id, txt from mytable ; drop procedure generate_rows ; drop table mytable purge ; Procedure GENERATE_ROWS compiled Table MYTABLE created. PL/SQL procedure successfully completed. insert into mytable (id,txt,tstz,dt,xml) select dbms_random.value(1,4),dbms_random.string('a',10),systimestamp,sysdate,NULL from dual connect by level <= :p_count ID TXT ---------- ---------- 3 WnSbyiZRkC 2 UddzkhktLf 1 zwfWigHxUp 2 VlUMPHHotN 3 adGCKDeokj 3 CKAHGfuHAY 2 pqsHrVeHwF 3 FypZMVshxs 3 WtbsJPHMDC 3 TlxYoKbuWp 10 rows selected Procedure GENERATE_ROWS dropped. Table MYTABLE dropped.
and here is the vision of Tom Kyte for the same https://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:2151576678914
Edit: to improve my code, it must use p_count as bind as Tom.
-
a list of all the tables, columns and their consntraints in the database
Hello
I need to write sql code which considers a list of all tables in the database, their columns and the primary or foreign key for each column (if any) and the refrence for each foreign key column.
Any ideas how ro?
DROP TABLE table_b; DROP TABLE table_a; -- CREATE TABLE table_a ( CONSTRAINT pk_table_a PRIMARY KEY (column_b) ,column_a INTEGER ,column_b INTEGER ); -- CREATE TABLE table_b ( column_c INTEGER ,column_d INTEGER CONSTRAINT fk_table_a REFERENCES table_a(column_b) ); -- SELECT utc.table_name ,utc.column_name ,CASE WHEN uc.constraint_type = 'P' AND position IS NOT NULL THEN uc.constraint_name END primary_key ,CASE WHEN uc.constraint_type = 'R' AND position IS NOT NULL THEN uc.constraint_name END foreign_key ,CASE WHEN uc.constraint_type = 'R' AND position IS NOT NULL THEN uc.r_constraint_name END referenced_key FROM user_tab_cols utc LEFT JOIN user_constraints uc ON (utc.table_name = uc.table_name) LEFT JOIN user_cons_columns ucc ON(ucc.table_name = utc.table_name AND utc.column_name = ucc.column_name AND uc.constraint_name = ucc.constraint_name) WHERE utc.table_name IN ('TABLE_A','TABLE_B');
TABLE_NAME COLUMN_NAME PRIMARY_KEY FOREIGN_KEY REFERENCED_KEY
TABLE_A COLUMN_B PK_TABLE_A
TABLE_A COLUMN_A
TABLE_B COLUMN_D FK_TABLE_A PK_TABLE_A
TABLE_B COLUMN_C
If you want to 'improve' the referenced_key column for the column referenced actually, you need to join user_cons_colums once again and use the column position.
Concerning
Marcus
-
Grant select privilege on the table column
Hello
I think that it is not possible to give the right to select level of column in a table.
by example-grant select (col1, col2) on table1 to User1;
Can anyone suggest what might be the way to achieve (apart from creating a view on the table).Hi, Anit,
Anit says:
Hi Frank,.
Thanks for the reply. Nothing bad to see.Then use a notice. It is simpler and more robust.
As that I knew WHAT EVP is used for the column data hide with a null value or other values. do not hide the entire column of the selection operation. Please correct me if I'm wrong.
Maksing the column with a null value or another value is hide the column.
Do what you should always do whenever you have a question. Post some sample data (CREATE TABLE and INSERT statements) and the results desired from these data. In this case, after an authorized user (that is, a user with all privileges) must get results and results that a user with lesser forge privileges.A view (or a copy of the table, as a materialized view) is the only way I know to prevent users to know that there is a column (for example) called credit_card_num.
Use row-level security, you can return NULL when users not allowed to reference credit_card_num, or you can trigger an error if they try to refer to this column. -
How to save the table column and row headings
I have a table where I activated the column and row headings. Once the table is loaded with data, I would like to save the contents of the table, including the column and row headings in a text file. The crux of "value" property returns only the content of the table, not the row and column headers. I could use "header line chains []" and '[] column header chains' property nodes as well, but I'm in the island there is an easier way. Looks like adding the headers of lines would be difficult. Any ideas?
Thanks in advance.
Here is a way. The construction with the empty constant is to provide to the left corner of the table where there is no data.
-
What is the table/column name for group of segments data
Hello!
I'm looking at the specific table/columns that contain the values for the segments of people group by assignment. Well want to can someone tell me.
Thank you.
Jon
Join the pay_people_groups with per_all_assignments_f with the people_group_id of the column
Maybe you are looking for
-
Printer does not not on Windows 7
I recently bought a new computer with Windows 7. I have a HP deskjet 940c printer (old but worked fine with XP). I can't find my original installation disk. How can I get the drivers to use the printer? This printer does not have a USB port, only
-
The United Kingdom Health Service was in line with microsoft learning resources. In order to access it, I had to sign up for Windows Live. I didn't do it, but it's not optional for accessing educational resources. Verified successfully, and can conn
-
image bitmap field not seized touch event
Hi all I've implemented a customButton class that extends from BitmapField to tuchscreen. The CustomField is FOCUSABLE. I placed 6 these customButtons in a horizontal field. First 3 buttons are getting clicked correctly but the last three are not cap
-
History of the files or Norton Backup
I have a Maxtor One Touch of my old PC. I moved to my PC Windows 8 and Seagate said that One Touch is not supported under Windows 8. Can I use story or Norton Backup file. What is the best to use? Thank you Lou
-
To the right personI don't know if there are others who have had problems with Adobe LightroomAfter the last update?I can't open, because it writes Windows can not access thefile, path or specified device. You don't have the permissions required toac