How to update the table with the number management
HelloI need as there is a loc_tab of the created table as below,
CREATE TABLE loc_tab
(
Country_ID NUMBER,
country_code VARCHAR2 (3),
country_name VARCHAR2 (50).
State_ID NUMBER,
state_code VARCHAR2 (3),
state_name VARCHAR2 (50).
city_id NUMBER,
city_code VARCHAR2 (3),
city_name VARCHAR2 (50)
);
I inserted records like below,
COUNTRY_ID COUNTRY_CODE COUNTRY_NAME STATE_ID STATE_CODE STATE_NAME CITY_ID CITY_CODE CITY_NAME
IND INDIA TN TAMIL NADU CHN CHENNAI
IND INDIA TN TAMIL NADU TRI TRICHY
IND INDIA TN TAMIL NADU CMT COIMBATORE
IND INDIA TN TAMIL NADU MDU MADURAI
IND INDIA AP ANDHRA PRADESH HYD HYDERABAD
IND INDIA AP ANDHRA PRADESH SEC SECUNDRABAD
AUS AUSTRALIA QLD QUEENSLAND BRI BRISBANE
AUS AUSTRALIA TAS TASMANIA HB HOBART
AUS AUSTRALIA TAS TASMANIA CCE CITY OF CLEARANCE
AUS AUSTRALIA TAS TASMANIA BUR BURNIE
Now, I wanted to update the table such that all ID columns are updated with running number.Each ID columns should get incremented so that, for Country_ID column corresponding to "India" If country_id is 1, that there must be one for all the lines with the name as "India". Likewise for "Australia".
In the case of State, she also has the same logic with numbers repeated until the very name of the State comes.
For the city, it of course will hold separate ID only because the name of the city will not get duplicated.
This update must be done in the normal way using simple SQL such as no PLSQL don't like looping, etc... is involved.
Here are the contents of the table, and that's how the table should be updated,
COUNTRY_ID COUNTRY_CODE COUNTRY_NAME STATE_ID STATE_CODE STATE_NAME CITY_ID CITY_CODE CITY_NAME
1 IND INDIA 1 TN TAMIL NADU 1 CHN CHENNAI
1 IND INDIA 1 TN TAMIL NADU 2 TRI TRICHY
1 IND INDIA 1 TN TAMIL NADU 3 CMT COIMBATORE
1 IND INDIA 1 TN TAMIL NADU 4 MDU MADURAI
1 IND INDIA 2 AP ANDHRA PRADESH 1 HYD HYDERABAD
1 IND INDIA 2 AP ANDHRA PRADESH 2 SEC SECUNDRABAD
2 AUS AUSTRALIA 1 QLD QUEENSLAND 1 BRI BRISBANE
2 AUS AUSTRALIA 2 TAS TASMANIA 1 HB HOBART
2 AUS AUSTRALIA 2 TAS TASMANIA 2 CCE CITY OF CLEARANCE
2 AUS AUSTRALIA 2 TAS TASMANIA 3 BUR BURNIE
Thank you and best regards,Shiva
Tags: Database
Similar Questions
-
How to find the number of data items in a file written with the ArryToFile function?
I wrote a table of number in 2 groups of columns in a file using LabWindows/CVI ArrayToFile... Now, if I want to read the file with the FileToArray function so how do I know the number of items in the file. during the time of writing, I know how many elements array to write. But assume that I want the file to be read at a later time, then how to find the number of items in the file, so that I can read the exact number and present it. Thank you all
Hello
I start with the second question:
bytes_read = ReadLine (file_handle, line_buffer, maximum_bytes);
the second argument is the buffer to store the characters read, so it's an array of characters; It must be large enough to hold maximum_bytes the value NULL, if char [maximum_butes + 1]
So, obviously the number of lines in your text tiles can be determined in a loop:
Open the file
lines = 0;
While (ReadLine () > 0)
{
lines ++;
}
Close the file
-
Best regards, tore my sticker with the serial number. I don't see the numbers. How to find the number of the whole installation?
Original title: windows 7 sn
Option 1:
If the COA sticker is damaged, you must use the recovery partition to reinstall Windows 7, it will be exempt from the need to use the product key to activate your installation of Windows 7.
Option 2:
If your recovery partition is not available or damaged, you must contact the manufacturer of your computer, and request that a defined recovery disk you can use to reinstall Windows 7. They could practice a small shipping and handling. This will exempt the need to also use the product key.
Option 3:
If neither options 1 or 2 is possible, then you will need to invest in a new license of full version of detail.
-
How to count the number of columns in an oracle table using sql
How to count the number of columns in an oracle table using sqlYou must put the name of the table in capital letters
As
SELECT COUNT(1) FROM user_tab_columns WHERE table_name = 'EMP'; or SELECT COUNT(1) FROM user_tab_columns WHERE table_name = UPPER('Emp');
Concerning
Arun -
problem while updating the number of lines.
Hello..
Im very new to obiee and now to learn things.
I'm using the following link to learn how to create a repository and work with it.
[http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/bi_admin/biadmin.html]
and im facing problem by updating the number of lines.
get a dialog like...
There is an error while updating the number of lines for "SH"... "" SH ". "" CHANNELS ".
+ [nQSError:17001] Oacle Eroorcode:942, message: ORA - 00942:table or view does not exist the OIC OCIStmtExecute call: select count (*) channels. +
+ [nQSError:17011] SQL statement execution failed. +
Wat could be the problem? can anyone help?
thnx in advance.Have you downloaded zip included in the tutorial and placed in the right place?
-
How to control the number of fields in the Advanced mode in <; af:query >;
Hello
How to control the number of fields in the Advanced mode in < af:query >?
Say I have 20 fields in my table, and I created a view of criteria with 2 fields. This would work perfectly in basic mode. But in Advanced mode , the choice of fields is possible by clicking on the Add fields button. I didn't have the customer to search with all 20 fields. Only 10 fields must be listed in the Advanced Mode, even if there are 20 fields in my table.
How can I control the list of fields in ADDFields button?
Any ideas?
KRYou can uncheck the contestable ownership of attributes that you must not appear in the Advanced Mode (but they will not appear in the other modes too!) or by programming the value the same as those mentioned here.
http://adfcodebits.blogspot.com/2010/11/bit-27-setting-view-object-attributes.html
Also, you can hide the button AddFields as suggested here - http://www.notjustjava.com/2011/12/cool-tips-to-showhide-components-of-the-query-control-of-adf/
-
How dynamically update the role of oracle using the trigger
How dynamically update the role of oracle using the trigger:
I have svmanger owner of schema in the database. There are five tables belonged to svmanager.
Table A, B, C, D, E.
I have a role that is played only to these tables under the scheme: SVMANAGER_READ_ONLY
now, if I create a new table F under svmanager. the role that svmanager_read_only does not work is updated, so the user had assigned role cannot access table F.
is there a way to create the trigger for this role dynamically update any when a table is created or deleted?
Thank you.I really really really don't suggest to do this - it's a bad habit. If possible I'd just adding the grant as part of the steps to the role on the new creation of the table.
But for fun here's how you can accomplish this:create or replace procedure execute_grant(v_ddl in varchar2) is begin execute immediate v_ddl; end; /
create or replace trigger catch_create_table_trg after create on schema DECLARE ddl_job number; ddl_str varchar2(50); begin IF ora_dict_obj_type = 'TABLE' THEN ddl_str := 'GRANT SELECT ON '||ora_dict_obj_owner||'.'||ora_dict_obj_name||' TO SVMANAGER_READ_ONLY'; dbms_job.submit(job => ddl_job, what => 'execute_grant(''' || ddl_str || ''');', next_date => sysdate+(5/24/60/60)); END IF; end; /
Test it
create table F (id number(1));
Validate
select * from ROLE_TAB_PRIVS where ROLE = 'SVMANAGER_READ_ONLY';
-
How to calculate the number of days/weeks/months between 2 dates?
Hello
I would like to know how to calculate the number of days/weeks/months between 2 dates in OBIEE 11 g, for example, I have 26/05/2013 and 19/05/2013, then I want to get 7 days.
Thank you!
JamieHi Jamie,
Through this links...
http://www.bravesoft.com/blog/?p=682
http://twobiee.blogspot.in/2012/01/working-with-date-differences.htmlMark as correct it allows u...
Thank you... -
Hi all
Could someone knows how to find the number of users connected to the database without connection with sql * more
y at - it a command to find?
example, we have 10 databases in a server, how to find the number of users connected to the special data base without connecting to database(v$session)?
the Oracle version:-10g, 11g
Operating system:-OEL4, OEL5, AIX, Solaris
any help will be appreciated.
Thanks in advance.
Thank you.
Kind regards
Rajesh.but you can say total number of connection with the above given the command? It would also be useful to know.
See you soon,.
LKM -
How to detect the number of created quickobjects
How to detect the number of quickobjects created? quickobject are quickbox2d.
Basically, I have a timer that will countdown to 4 seconds and it will create a falling ball, it will get removed when she falls down. However, I want only there so that if more than 5 bullets are in step, it will cease to create until it is less than 5 to start creating some balls again. Is there a way I can do?
It's the timer to create the ball
If (! _ballCreation_timer) {}
_ballCreation_timer = new timer (4000);
_ballCreation_timer.addEventListener (TimerEvent.TIMER, _onBallCreationTimer);
}
_ballCreation_timer. Start();
Function which create the ball based on clock
function _onBallCreationTimer (e:TimerEvent): void {}
_doCreateNewBall();
}
function _doCreateNewBall() {}
_ball_quickobject = sim.addCircle ({x: PHYSICS_SCALE * (960), y: PHYSICS_SCALE * (10), RADIUS: 0.5, draggable: false});
MAKE A LIST OF BALLS
_balls_array.push (_ball_quickobject);
}
This is the part where if the table (QuickObject) ball falls down and are destroyed
addEventListener (Event.ENTER_FRAME, _onEnterFrame);
DRAW EACH BALL FALLING OUT OF THE SCREEN
function _onEnterFrame (aEvent: Event): void {}
for each (var quickObject: QuickObject in _balls_array) {}
BALL FALLING OUT OF THE SCREEN?
If (quickObject.y / PHYSICS_SCALE > 1080) {}
_doHandleBallOffScreen (quickObject);
}
}
}
DESTROY THE BALL FALL OFF THE SCREEN IF
function _doHandleBallOffScreen (aQuickObject: QuickObject): void {}
DESTROY THE OBJECT
aQuickObject.destroy ();
REMOVE FROM THE CUSTOM TABLE
_balls_array.splice (_balls_array.indexOf (aQuickObject), 1);
}
check the length of _balls_array. If it is greater than 5, do not create another bullet:
If (! _ballCreation_timer) {}
_ballCreation_timer = new timer (4000);
_ballCreation_timer.addEventListener (IMER TimerEvent.T, _onBallCreationTimer);
}
_ballCreation_timer. Start();
Function which create the ball based on clock
function _onBallCreationTimer (e:TimerEvent): void {}
_doCreateNewBall();
}
function _doCreateNewBall() {}
If (_balls_array.length<>
_ball_quickobject = sim.addCircle ({x: PHYSICS_SCALE * (960), y: PHYSICS_SCALE * (10), RADIUS: 0.5, draggable: false});
MAKE A LIST OF BALLS
_balls_array.push (_ball_quickobject);
}
}
This is the part where if the table (QuickObject) ball falls down and are destroyed
addEventListener (Event.ENTER_FRAME, _onEnterFrame);
DRAW EACH BALL FALLING OUT OF THE SCREEN
function _onEnterFrame (aEvent: Event): void {}
for each (var quickObject: QuickObject in _balls_array) {}
BALL FALLING OUT OF THE SCREEN?
If (quickObject.y / PHYSICS_SCALE > 1080) {}
_doHandleBallOffScreen (quickObject);
}
}
}
DESTROY THE BALL FALL OFF THE SCREEN IF
function _doHandleBallOffScreen (aQuickObject: QuickObject): void {}
DESTROY THE OBJECT
aQuickObject.destroy ();
REMOVE FROM THE CUSTOM TABLE
_balls_array.splice (_balls_array.indexOf (aQuickObject), 1);
}
-
How to count the number of elements in a data block
Hi all
How to count the number of elements in a particular data block oracle Forms 10g.
If it's a text_item or the display_item or the list_item etc is there any method to do this.
Please answer...get the first element with GET_BLCOK_PROPERTY(..., FIRST_ITEM);
loop until GET_ITEM_PROPERTY(..., NEXTITEM) is null
count on in the loop. -
How to control the number of lines of text below the image in the slideshow module?
Lightroom 3.3
How to control the number of lines of text below the image in the slideshow module? I have an image with 36 words in the caption field which exports like two lines GOOD.! I have another image with 57 words in the field of legend who runs the page and shows only a VERY BAD line. With 57 words I can't do the single-line text box small enough to keep the text does not spread out of the page.
Ideas?
On the Mac platform and I expect similar under Windows, just hit enter or return key will not help. Instead, you will have to hit the keys Ctrl + Enter or Ctrl + return. This forces a new line. Windows may use a different modifier key. The screenshot below shows that it is possible. Unfortunately, you need to add the text via the caption or Description field in the library module.
-
How to change the number of minutes for the exercise of the activity of the application
How to change the number of minutes for the exercise of the activity of the application
Hello
It is not currently possible to change the goal of daily exercise.
If you want to suggest that Apple consider adding this option, you can submit a request here:
-
How to adjust the number of rings on 6s before answering iPhone begins
How to adjust the number of rings on iPhone 6s before the beginning of voicemail?
Contact your operator. That is controlled by them. It is not based on the number of rings, it is based on time.
-
How to set the number of e-mail messages that are stored on my iPhone
How to set the number of e-mail messages that are stored on my iPhone – so when I don't have a network connection I can see a 'large' number of messages in my Inbox etc.
This is series is not defined in the world
You must go to settings-> mail, contacts, and calendars and check the settings of your e-mail provider offers in this area
-
How to increase the number of addresses in the BCC field?
How to increase the number of addresses in the BCC of email field?
What do you mean by increase in the number of addresses? The CCC line will continue to accept addresses that you add them in there. Keep just by typing in the addresses separated by a semi colon ";
Maybe you are looking for
-
How to change the power supply to the CD/DVD drive so that it is disabled by default?
When running on battery I often use the icon 'Remove hardware safely' XP to 'unplug' the carpet * CD/DVD drive for Safe some battery life. (Does?) I use Fn + Tab to bring back to life. I wonder if there is a way to make my boot Notebook (M400) with t
-
Satellite A200 - 23Q - issue processor upgrade
Hello, I am from Greece, and I'm new here, I know im newbe... I have toshiba Satellite A200 - 23q (motherboard: intel gm965, cpu: t5550 (1, 8 GHz))... Currently, I bought Intel T7500 (2, 2 GHz)...Can I upgrade this laptop with this processor? What ca
-
Modbus, writing in the registers by PID regulator
Hello Can you please help... I'm new here I try to use a registry read, send the value to a PID vi, then write in a register. I've attached an example of using a temperature regulator. I get errors whenever I try to connect using clusters, clusters,
-
I have a HP Envy 4500 and cannot print on a map. He keeps jammed in the printer.
-
12 cell Battery (pluged, load) but not charging
I bought a new battery 12 cells, I have a hp pavilion dv6 1211ax ; the problem is that after I unload completely the battery does not charge after that. I managed to load the battery afer the critical battery warning (no questions). * battery health