Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa SQL retrieve the records from one table to another table by using cursors

Have Programming Question? Ask it here!
 
 
 


lakshmi
retrieve the records from one table to another table by using cursors
0 Answer(s)      11 months ago
Posted in : SQL


Hi I'm fresher to backend(mysql),my requirement is retrieve the records from one table to another table by using cursors.The following is my procedure and tables.After execution it insert one extra record to another table. empproc procedure:

create procedure empproc() begin declare ename varchar(12); declare d int default 0; declare cur cursor for select name from emp; declare continue handler for not found set d=1; open cur; lb1:loop if d=1 then leave lb1; end if; if not d=1 then fetch cur into ename; insert into emp2 values(ename); end if; end loop; close cur; end; //

The actual data is bellow one:

mysql> select * from emp; +------+------+-------+ | eid | name | sal | +------+------+-------+ | 1 | aaaa | 12334 | | 2 | bbbb | 15334 | | 3 | cccc | 15336 | +------+------+-------+ 3 rows in set (0.00 sec)

after executing the procedure i'm getting the following result.print("code sample");

mysql> select * from emp2; +-------+ | ename | +-------+ | aaaa | | bbbb | | cccc | | cccc | +-------+ 4 rows in set (0.00 sec)


Advertisement
View Answers

Related Tutorials/Questions & Answers:
retrieve the records from one table to another table by using cursors
retrieve the records from one table to another table by using cursors  ... from one table to another table by using cursors.The following is my procedure and tables.After execution it insert one extra record to another table. empproc
update one table from another table
update one table from another table  hello, i need to update one table fields by using another table fields. I have to tables Products.... for example TotalQuantity field from Products table should be updated if i
Advertisements
copying data from one table to another
copying data from one table to another  i need to copy data from one table to another table.. i.e the 1st eid of employee table must be copied to the 1st eid in appusers table, 2nd eid of employee to the 2nd eid of appusers
take data from one table and insert same in another
take data from one table and insert same in another  I want to know when a new field update in table and the same data has to update in another table
retrieve record from table
for a single record. I have to retrieve these data from the field table. Actually...retrieve record from table  Hi. I have a field in database named... chennai as one value, trichy as one value. and i have to show it in html. how
how to move records from one table to other based on its creation time
how to move records from one table to other based on its creation time  Hi all,, As part of my requirement ,the records in one table have to move... to the second table,has to delete from first table.. I am using oracle10, Any suggestions
retrieve record from the field table
,kanchipuram for a single record. I have to retrieve these data from the field table...retrieve record from the field table  Hi. I have a field in database... values like chennai as one value, trichy as one value. and i have to show it in html
How to retrieve record from table
,kanchipuram for a single record. I have to retrieve these data from the field table...How to retrieve record from table  Hi. I have a field in database... like chennai as one value, trichy as one value. and i have to show it in html
Retrieving data from table using DBCP
;from a table!\n");     BasicDataSource 
Retrieve Value from Table - Hibernate
Retrieve Value from Table   Hai friend, I need help, How can i retrieve values From database using hibernate in web Application. As I new to hibernate I couldn't find solution for this problem.. Can anyone help please.. 
Fetch user records from a table in database
Fetch user records from a table in database  Hi. I have a field...,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values
Copy One Database Table to Another
Copy One Database Table to Another   ... to another database table. That means we copy one table to a different table...;java CopyOneDatabaseTableToAnother Copy data from one database table
retrieve Dept Name from table dept and retrieve list of employee from emp table for that dept in combobox
retrieve data from database from table1 and display it in another textbox and from the same input paramter then its should retrieve the data from another table...retrieve Dept Name from table dept and retrieve list of employee from emp table
Retrieve multiple data from database into Table.....
Retrieve multiple data from database into Table.....   hi........... I want to Retrieve multiple data from database into Table but i am not able to.... i am only able to retrieve one value not more than that. means in my
retrieve record from table and show it in HTML
retrieve record from table and show it in HTML  Hi. I have a field...,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values
I have to retrieve these data from the field table
I have to retrieve these data from the field table  Hi. I have... chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values
HTML & MYSQL - retrieve record from table
HTML & MYSQL - retrieve record from table  Hi. I have a field...,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values as single
MYSQL retrieve record from Data table
MYSQL retrieve record from Data table  Hi. I have a field in database...,kanchipuram for a single record. I have to retrieve these data from the field table. Actually they are separated by comma. I want to take the values as single
reading the records from a .xlsx file and storing those records in database table
reading the records from a .xlsx file and storing those records in database table  Here is my requirement, I want to read the records from a .xlsx file and store that records in database table. I tried like this public class
How to compare two tables, and insert values which r not in one table to another table?
How to compare two tables, and insert values which r not in one table to another table?  Hi I need to compare two tables MainTable and OUTTable... MT (MT.serialno) values (Select SerialNo Main_Table MT from where not exists
how to retrieve data from table with runtime values in sql?
how to retrieve data from table with runtime values in sql?  how to retrieve data from table with runtime values in sql? For example, I have table... to execute the command with the dates which I pass. I know how to retrieve a particular
JDBC: Select Records using Prepared Statement
how to retrieve records of table using Prepared Statement. Select Records ... the common sql query. Select statement is used to retrieve records from the table... records from the student table whose roll no is less than 10. package jdbc
how to count unique and duplicate values from one table in mysql?
how to count unique and duplicate values from one table in mysql?  I have use EMP table.I want to count unique and duplicate records from emp table and how to use in java program
Mysql From Table
Mysql From Table       Mysql From Table is used to specify the table from which the records... for From The keyword 'from' is used to specify the table 'Stu' from which records
Adding a flex table in another flex table column
Adding a flex table in another flex table column  how to add a flex table in another flex table column
Insert Records in Table
Insert Records in Table       The Insert data in Table is used to insert  records or rows into the table in database. The Syntax used to insert records into a table
PHP WHERE clause example to fetch records from Database Table
the data within the MYSQL database table. You can also fetch the results using... Server and will fetch the results from the database table employee date is equal... different actions in MYSQL Database Tables. PHP WHERE Clause is one of them. We
delete row from a table using hibernate
delete row from a table using hibernate  //code in java file String hql="delete from CONTACT c where ID=6"; Query query=session.createQuery... [delete from CONTACT] int i=query.executeUpdate
how to display a table from database using servlet
how to display a table from database using servlet  how to display a table with values from servletpage   Hi Friend, Please go through the following link: http://roseindia.net/jsp/servlet-jsp-data-list.shtml Thanks
JDBC : Duplicate records in a table
JDBC : Duplicate records in a table In this tutorial, you will learn how to find the duplicate records in a table. Duplicate records in a table : You can check for duplicate records of table. You can group record by any of fields
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>"> common.jsp <%String attr=request.getAttribute("param"); out.print(attr
Problem passing a value from one jsp to another using href
Problem passing a value from one jsp to another using href  first page.jsp <a href="common.jsp?param=<%l.get(k).parentname%>"> common.jsp <%String attr=request.getAttribute("param"); out.print(attr
storing records which of a file into a table of mssql database
storing records which of a file into a table of mssql database  I... same as column names of a table. I have to store those records into a table as records using hibernate and jdbc
how to insert one table to anothere table
how to insert one table to anothere table  i have insert the record one table then i retrve the value of that table i insert one value at a time
Display table performing action on another table
Display table performing action on another table In this section, we have created two tables. The data in table 1 have shown as a result of the database... of the table row, another table will be displayed showing the data of that row
Adding checkbox in table using that delete table rows
Adding checkbox in table using that delete table rows  I need coding for how to add checkbox in table,the table data from database.Using that checkbox select more than than one rows,and using delete button i want to delete
How to export the table content from an webpage to excel using java?
How to export the table content from an webpage to excel using java?  How to export the table content from an webpage to excel using java? The table contents are generated dynamically in that java page
How to export the table content from an webpage to excel using java?
How to export the table content from an webpage to excel using java?  How to export the table content from an webpage to excel using java? The table contents are generated dynamically in that java page
Retrieving Data from the table using PreparedStatement
Retrieving Data from the table using PreparedStatement... to fetch the data from the database in the table from our java program using...() method of the PrintWriter class. We can retrieve the data from the database only
Select data from Table in Database
the selected data from table in database. The select query in the database retrieve... table. select * from table; The select query retrieve all the column present... to retrieve the data from table. In this Tutorial we create a table country
create a table in access2007 from gui application using textfields and combox
create a table in access2007 from gui application using textfields and combox  I want to create a table in ms access 2007 from gui application in which when i click create button the table should get created based on textfield
how to load a table of data from oracle, to a jsp page using hashmap.
how to load a table of data from oracle, to a jsp page using hashmap.  I have a jsp page which ask for project ID,team name,member name according to this data i have to retrieve their details from the database(oracle). I have
Retrive the data from the table in data base using jdbc
Retrive the data from the table in data base using jdbc  Retrive the data from the table in data base using jdbc   JDBC Tutorials
table?
can't figure out, how to construct a table,with two fixed columns, one that reads and records in the Number column how many timeseach Codon occurred in the input...table?  Hi, how could i make a table in javascript, which would look
Adding button to each row for the table and adding row to another table
Adding button to each row for the table and adding row to another table  Hi I need to add button to each line in the table(Table data is retrived... row of the table
how to insert the bulk data into the data base from the table of jsp page to another jsp page
how to insert the bulk data into the data base from the table of jsp page to another jsp page  pls help i'm doing the project called centralized... and i have to insert the mark for n number student in the table i don't how
how to get multiple hyperlink values from a table column to another jsp file?
how to get multiple hyperlink values from a table column to another jsp file... file named "dbtable" will get the parameter from "index" and search for the user string in the database, as a result a table will come up with 3 columns itemid
how to display values from database into table using jsp
how to display values from database into table using jsp  I want to display values from database into table based on condition in query, how... to display books based on either bookname or authorname, for this i created one jsp page
Pls provide me jsp code to get values in drop down list from another table's field....
Pls provide me jsp code to get values in drop down list from another table's field....  my project has customer registration and company registration pages..... when i insert data in company registration .. it ll have company id
table
table  multiplicatyion table
Advertisements
 

 

 

DMCA.com