Reputation: 241
Recently I'm learning sql by myself and it's really tough to me.
For example I'd like create a sql class called XXX and also I'd like add some attributes into the class like country, population, etc.
So how do I write the code? Can anyone show me how to do that with a simple example?
I would fully appreciate for that.
Upvotes: 0
Views: 141
Reputation: 5459
You can create a Type
like below.
CREATE OR REPLACE TYPE MYCLASS AS OBJECT
(Country varchar2(30),
Population varchar2(30)
);
/
CREATE TABLE MYTABLE of MYCLASS;
Upvotes: 1
Reputation: 7376
You can create table like this:
create table your_class_table
(
country varchar2(2000 char),
population number
)
then you can insert data into it then select.
Upvotes: 1