answersLogoWhite

0


Best Answer

You retrieve, store, and update SQL3 datatypes the same way you do other datatypes. You use either ResultSet. getXXX or CallableStatement. getXXX methods to retrieve them, PreparedStatement. setXXX methods to store them, and updateXXX to update them. Probably 90 percent of the operations performed on SQL3 types involve using the getXXX , setXXX , and updateXXX methods. The following table shows which methods to use:

SQL3 type

getXXX method

setXXX method

updateXXX methodBLOB

getBlob

setBlob

updateBlobCLOB

getClob

setClob

updateClobARRAY

getArray

setArray

updateArrayStructured type

getObject

setObject

updateObjectREF (structured type)

getRef

setRef

updateRef

For example, the following code fragment retrieves an SQL ARRAY value. For this example, the column SCORES in the table STUDENTS contains values of type ARRAY . The variable stmt is a Statement object. ResultSet rs = stmt.executeQuery( "SELECT SCORES FROM STUDENTS WHERE ID = 2238"); rs.next(); Array scores = rs.getArray("SCORES");

The variable scores is a logical pointer to the SQL ARRAY object stored in the table STUDENTS in the row for student 2238.

If you want to store a value in the database, you use the appropriate setXXX method. For example, the following code fragment, in which rs is a ResultSet object, stores a Clob object: Clob notes = rs.getClob("NOTES"); PreparedStatement pstmt = con.prepareStatement( "UPDATE MARKETS SET COMMENTS = ? WHERE SALES < 1000000", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); pstmt.setClob(1, notes);

This code sets notes as the first parameter in the update statement being sent to the database. The CLOB value designated by notes will be stored in the table MARKETS in column COMMENTS in every row where the value in the column SALES is less than one million

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago
Data types in java:1.Boolean eg-boolean b=true;

2.Character eg-char a='a';

3.Byte eg-byte b=10;

4.Short eg-short a=20000;

5.Integer eg-int s=200000;

5.Long eg-long=73254854564;

6.Float eg-float f=54.67;

7.Double eg-double s=4.680895;

8.String eg-String s="fdfulfief";

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Explain the various data types available in SQL?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

What are the various data types for entering records?

Data types for entering records depend on the nature of data


Show the various stages in data warehousing and business analytics and also explain it in brief?

show the various stages in data warehousing and business analytics


What are the different types of data bases available?

3


What is datatype.Define various types of data types?

In c language data types are used to specify the tye of data.for ex:int a;It means "a" is a variable of type integer.There are two types of data types in c.They areprimary data typessecondary data typesprimary data types are the built in data types and secondary data types are the user defined data types.eg for primary data types are int,float,char,long,double..and for secondary are arrays,structures,pointers,unions..


Explain any three data types in C?

Int.,Float.Double,Character


What is meant by data type and briefly explain some commonly used data types in oracle?

right answer is in the sky.


What are the different user define data typesexplain with example?

what are the different user define data types explain with example


Can data be recovered from a tape?

Yes, data can be recovered from a tape using various software available in the market.


What are the various file-accessing techniques in data management system?

Explain the various file-accessing techniques in data management system. Also state the advantages and limitations of each technique


Explain Information and its types?

the processed data is known as a information. information can be classified into following types . strategic operational statistical


Explain various types of data formats that the 8087 is design to work with?

The 8087 Math CoProcessor can work with two data formats: temporary real and packed decimal. Each data instruction, whether real or decimal, can be up to 80 bits long.


Types of data used in programming?

Programmers have to declare various data types while coding in order to inform the computer how to handle them. The types include numbers, arrays, characters, booleans and structures.