As a disclaimer, I am not a database person. I have some basic knowledge, but my area is in other fields. Please treat me like I am stupid when it comes to this question.
An Oracle script has been dumped on me, which I have been able to work out an understanding of, but I need to make a change to it. The script takes data from several different tables and puts it all together into a temporary table where various changes are made before it reports what it has. I need to add a simple loop which goes over each row and increments a value until a certain condition is met. This much I can handle, but there is no way to track my place in the table. I want to add a column that simply indexes the table 1,2,3,...,n. I have tried to Google this, but either I could not find it, or I could not understand it. I think it may have been the latter.
The table creation takes the following basic form (there are a lot of values, so copying it all in would be over-kill):
How do I modify this to add an indexing column?
You mean like access has?
1. create a sequence - make sure it has a public synonym so other users can access it
see HELP CREATE SEQUENCE
see help on create synonym
see help on grant to allow others to access the sequence
2.
lets you get the next value from the sequence.
You are gonna have to give us a better example than your select statement, so we can give you a working example of putting the sequence number into your table.
If you are having performance problems consider adding an index to your table.
Sorry, I do not think I follow. It is not a performance issue --- this is only a temporary table that gets thrown away later. After this table is built, I will be adding a section which loops over it, something like:
count number;
count = 1;
select max(index) into max_rows from temp;
while count <= max_rows
loop
update temp set x=y where index=count;
count = count + 1
endloop;
I want to add column of sequential, unique numbers to the table (either during or after creation) that I can use as, basically, my place-holder as I update each row in the table. The select I showed was exactly how the table is built (albeit the original has create table temp as select a.colum1, b.colum2, b.column10 from table1 a, table2 b where a.column1='blah' and b.column2='blah', etc).
Thanks for the help there. It took a little messing around to get it to work (apparently sequences cannot be used in a select within a select), but eventually I managed to sort things out. It seems awfully complicated for what seems a simple enough operation, but I learned quite a few things out of this.
hi,
i need to copy one table with data into another table,
right now am using
create table table1 as select * from table2
i want the constraints of table1 to be copied to table2 also , can anyone give me some solution to copy the constraints also, now am using oracle 10.2.0.3.0... (1 Reply)
Hello everyone,
Here is what i am trying to accomplish. I have a transaction log that I want to to add a field. The fields in the transaction log are tab delimited FYI. My goal is to add a column specifying the category/type to each item purchased. I have created a two column "conversion table"... (2 Replies)
I have requirement:
1) Check the record count in table (table in oracle)
2) If records exists generate the file for existing records and wait for some time then Go to sleep mode and
Again check the record count after 10 min.......... (Loop this process if record count >0).
3) Generate touch... (1 Reply)
I have requirement:
1) Check the record count in table (table in oracle)
2) If records exists generate the file for existing records and wait for some time (Go to sleep mode) and
Again check the record count after 10 min.......... (Loop this process if record count >0).
3) Generate touch... (1 Reply)
Hi All,
I am trying to get the spaces in the below table to be fill up with a character " - ". For eg, coordinates 0202 is a space but i would want to fill up with " - ". Can anybody help ?
Input:
04 D H ... (15 Replies)
Hi, I'm trying to write a program with unix shell scripting to track the changes of a particular table in the Oracle database.
I've try reading up on sql TRIGGER function, but I'm not sure if its feasible here. Any idea what kind of syntax should I use to track the changes in the table? Can... (0 Replies)
In my college dorm, there is a file sharing network in the entire building. Problem is, there is only a manual for windows with the settings on how to connect... :mad:
They say that you have to give the following command in cmd in windows:
route add 172.16.71.0 mask 255.255.255.0... (2 Replies)