Home » SQL & PL/SQL » SQL & PL/SQL » electronic data sharding
electronic data sharding [message #657693] Fri, 18 November 2016 13:31 Go to next message
sudeepto chattaraj
Messages: 9
Registered: November 2016
Junior Member
how to swap the rows using plsql..
i have made 3 tables..bt i want to swap the values of the rows..how could i swap it???

create table department (dept_id varchar2(50) primary key,dept_name varchar2(50),bank_id varchar2(50) REFERENCES bank1(bank_id) ,doj date);
create table bank1(bank_id varchar2(50) primary key,bankname varchar2(50),sal varchar2(50),customername varchar2(50),phno number(10),email varchar2(50));
create table employee(emp_id varchar2(50) primary key,dept_id varchar2(50) REFERENCES department(dept_id),empfirstname varchar2(50),emplastname varchar2(50),sal number(12),phno number(10),email varchar2(50),bank_id varchar2(50)REFERENCES bank1(bank_id));

insert into bank1 values(:bank_id,:dept_name,:bankname,:customername,:phno,:email);
insert into department values(:dept_id,:dept_name,:bank_id,:doj);
insert into employee values(:emp_id,:dept_id,:empfirstname,:emplastname,:sal,:phno,:email,:bank_id);




but how could i swap the values..?????
  • Attachment: project.txt
    (Size: 0.82KB, Downloaded 42 times)
Re: electronic data sharding [message #657694 is a reply to message #657693] Fri, 18 November 2016 13:37 Go to previous messageGo to next message
BlackSwan
Messages: 25792
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:
OraFAQ Forum Guide
How to use {code} tags and make your code easier to read

> i want to swap the values of the rows..how could i swap it???
I do not understand.
swap what for what?
Re: electronic data sharding [message #657695 is a reply to message #657694] Fri, 18 November 2016 13:44 Go to previous messageGo to next message
sudeepto chattaraj
Messages: 9
Registered: November 2016
Junior Member
like i have 5 cols ok?
empid ename
e1 abc
e2 pqr
e3 mno
e4 jal
e5 ab1
if this is a table.. bt i want to swap like
empid ename
e1 mno
e2 jal
e3 pqr
e4 abc
e5 ab1
Re: electronic data sharding [message #657696 is a reply to message #657695] Fri, 18 November 2016 13:47 Go to previous messageGo to next message
sudeepto chattaraj
Messages: 9
Registered: November 2016
Junior Member
i want to change all the data..all the datas are mix in a specific rule..
Re: electronic data sharding [message #657697 is a reply to message #657696] Fri, 18 November 2016 13:58 Go to previous messageGo to next message
Michel Cadot
Messages: 65317
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

And the specific rule is?
Where does come empid and ename that are not in your tables?
How the tables are related to your question?

Please post CREATE TABLE and INSERT statements for the data you gave.

Re: electronic data sharding [message #657699 is a reply to message #657697] Fri, 18 November 2016 14:05 Go to previous messageGo to next message
sudeepto chattaraj
Messages: 9
Registered: November 2016
Junior Member
i hve told this fr an exple.. i want to do like this..if there r two cols ..empid and empname then my motive is swap the values in like this way.. this techn i will use my main project..
Re: electronic data sharding [message #657700 is a reply to message #657699] Fri, 18 November 2016 14:07 Go to previous messageGo to next message
Michel Cadot
Messages: 65317
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Use UPDATE.

Re: electronic data sharding [message #657704 is a reply to message #657700] Fri, 18 November 2016 14:20 Go to previous messageGo to next message
sudeepto chattaraj
Messages: 9
Registered: November 2016
Junior Member
bt how.. send me the whole code..
Re: electronic data sharding [message #657705 is a reply to message #657704] Fri, 18 November 2016 14:22 Go to previous messageGo to next message
Michel Cadot
Messages: 65317
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

How can I send some code when I have not the tables, data and rules?

Re: electronic data sharding [message #657706 is a reply to message #657705] Fri, 18 November 2016 14:26 Go to previous messageGo to next message
sudeepto chattaraj
Messages: 9
Registered: November 2016
Junior Member
i hve post the attchmnt..it contns the code.. u make the table send me the code..
i cant .. please help me
Re: electronic data sharding [message #657707 is a reply to message #657706] Fri, 18 November 2016 14:30 Go to previous messageGo to next message
Michel Cadot
Messages: 65317
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

You have posted CREATE TABLE we don't how they are related to the question.
You have NOT posted INSERT statements for some data
You have NOT posted the rules to convert the current data to the target one.

Re: electronic data sharding [message #657708 is a reply to message #657706] Fri, 18 November 2016 14:32 Go to previous messageGo to next message
Michel Cadot
Messages: 65317
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Also "u", "attchmnt", "contns", "hve"... are NOT English words.
Post whole words, if you program as you post then you will never can't do anything correct.

[Updated on: Fri, 18 November 2016 14:32]

Report message to a moderator

Re: electronic data sharding [message #657709 is a reply to message #657708] Fri, 18 November 2016 14:36 Go to previous messageGo to next message
sudeepto chattaraj
Messages: 9
Registered: November 2016
Junior Member
thank you for supporting me.. hmm i know thats are not english word
Re: electronic data sharding [message #657756 is a reply to message #657709] Mon, 21 November 2016 11:57 Go to previous messageGo to next message
Bill B
Messages: 1709
Registered: December 2004
Senior Member
in your insert columns, the values are invalid. what is :bank_id? to insert the varchar2(50) column you would need something like

values('mybankid'...
Re: electronic data sharding [message #657775 is a reply to message #657706] Tue, 22 November 2016 07:26 Go to previous message
EdStevens
Messages: 887
Registered: September 2013
Senior Member
sudeepto chattaraj wrote on Fri, 18 November 2016 14:26
i hve post the attchmnt..it contns the code.. u make the table send me the code..
i cant .. please help me
You STILL have not stated the rule by which you transform the data from what you have to what you want. You've given an example of "I start with <this> and want to get it to <that>" but you have yet to provide a rule or specification of how the end result relates to the beginning.
Previous Topic: Update Table Based On Another Table
Next Topic: complex query
Goto Forum:
  


Current Time: Tue Jan 16 02:45:17 CST 2018

Total time taken to generate the page: 0.02649 seconds