473,795 Members | 2,983 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

equivalent of table.column%TY PE

-
in oracle there is a '%TYPE' to reference the data type of another
column. is there an equivalent in mysql? thank you.
Jul 23 '05 #1
7 2652
-
- wrote:
in oracle there is a '%TYPE' to reference the data type of another
column. is there an equivalent in mysql? thank you.


anybody? do help...
Jul 23 '05 #2
- wrote:
in oracle there is a '%TYPE' to reference the data type of another
column. is there an equivalent in mysql? thank you.


I'm not sure what you are going to do with it, but the best I can think
of it describe:

http://dev.mysql.com/doc/mysql/en/describe.html
Jul 23 '05 #3
-
Aggro wrote:
I'm not sure what you are going to do with it, but the best I can think
of it describe:

http://dev.mysql.com/doc/mysql/en/describe.html


what i want to do is to refer to the column's data type.

CREATE TABLE country
(
code CHAR(2)....
....
)

CREATE TABLE user
(
..
country_code country%TYPE
..
)

in this case the code's data type is permanently 2 char long but for
other fields, it would be easier if i just put '...%TYPE' so that if the
original field changes, i do not have to change the other fields that
refer to it.

Jul 23 '05 #4
- wrote:
in this case the code's data type is permanently 2 char long but for
other fields, it would be easier if i just put '...%TYPE' so that if the
original field changes, i do not have to change the other fields that
refer to it.


There's nothing like that which I would know.

I got only something like 3 years of work experience in building
databases, but I have never even thought that I could have a problem
like that. Do you really change the column types in your database so
often that you really need to worry about this? Do you really have so
many references to other column types that you couldn't do that manually
if you need to change it?

If I have a reference to other table, I always use int unsigned -type. I
have never had a need to change it. Normal columns that haven't been a
reference to anywhere, sometimes need the change, but in those cases the
%TYPE wouldn't help.
Jul 23 '05 #5
-
Aggro wrote:
If I have a reference to other table, I always use int unsigned -type.


can you rephrase this? i don't get what you mean. thanks.
Jul 23 '05 #6
- wrote:
Aggro wrote:
If I have a reference to other table, I always use int unsigned -type.

can you rephrase this? i don't get what you mean. thanks.


Ok, your example would be this:

CREATE TABLE country
(
id int unsigned primary key;
code CHAR(2);
....
)

CREATE TABLE user
(
..
country_id int unsigned;
..
)

So, now the reference to other table is "int unsigned". And like I said,
I have never had a need to change that reference type to another.
Jul 23 '05 #7
-
Aggro wrote:
Ok, your example would be this:

CREATE TABLE country
(
id int unsigned primary key;
code CHAR(2);
....
)

CREATE TABLE user
(
..
country_id int unsigned;
..
)

So, now the reference to other table is "int unsigned". And like I said,
I have never had a need to change that reference type to another.


in this example where int is used is acceptable. but when the code is
the primary key where there can be two and three character country code
formats (e.g US and USA).

therefore, the master table will have a CHAR(2) or CHAR(3) and referring
tables will need to know the used data type. so, if mysql has a %TYPE,
it would eliminate the need for referring tables to change the data type
each time the master table's type is changed. although the search and
replace function do make life easier.
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2528
by: Albretch | last post by:
I am trying to insert some textual data belonging to an HTML page into a table column with 'TEXT' as data type mysql's maual _/manual.html#String_types tell you, you may insert up to (2^16 - 1), that is 65535 characters, but I am getting errors when I try to insert a column larger than 236 characters. Initially I thought it might be because I had to escape some characters, but after playing a some scenarios and just inserting a bunch...
0
1329
by: vadnala | last post by:
I am a newbie and struggling to get the correct Column "Type". I really appreciate if someone can shed some light here.. I have a table XXX which has 4 columns with types char(2), varchar(5), int(10) and int(10) respectively. But, when I use the following code, I don't get the correct type from MYSQL_FIELD structure!! int nSuccess = mysql_query ( (MYSQL*)m_hdb, "select * from XXX" );
4
1062
by: Justin | last post by:
Using an SqlDataReader what is the best way to determine if a table column has specified value? Thanks, Justin.
4
6467
by: Ying Lu | last post by:
Hello, Under mysql, we have "desc tablename" to get the detail information about a table. My question is about to get column name, and column type for a specific table under PostgreSQL through JDBC. Assume we have a table named "test". Under PSQL, we can input "\d test" to see the details about table "test" successufully. However, my main purpose is trying to get column name, column name of a table through JDBC.
4
4822
by: joshd | last post by:
can anyone help me figure out why when i run the following stored procedure i get the error: (1460 row(s) affected) Msg 245, Level 16, State 1, Procedure SP_SALESTRENDS, Line 40 Conversion failed when converting the varchar value 'X' to data type int. SP:
1
3190
by: lee1212 | last post by:
Hi I use vb.Net to open an access db for my software and i have one issue that i don't know how to do, I need to change an exsiting Column that might have some records in it from Text(250) to Memo type cuz i need to store some text that its length is more then 250. Is there any way that i can do something like: Alter Table TABLENAME {Alter Column COLUMN1 Memo} and to change the column type from text to memo without delete the records?...
13
7561
by: rupak | last post by:
Hi! I have a multiple selection of checkboxes <input type='checkbox' name='coffee' id='col1' value='Address'/> <input type='checkbox' name='coffee' id='col2' value='Name'/> <input type='checkbox' name='coffee' id='col3' value='ID'/> <input type='checkbox' name='coffee' id='col4' value='UserName'/> <input type='checkbox' name='coffee' id='col5' value='Code'/>
8
6791
by: mguy27 | last post by:
We have about 2 dozen security officers who patrol about 120 buildings. They find defective or unlocked doors and write a "Trouble Report" on the door. This card gets turned in, where I have designed an Access Field and Table to enter the information and store it. They then get emailed to their respective supervisors so the problems can be dealt with. As of right now, we have a big list on the wall of the buildings and their supervisors....
3
3491
by: jagdeep gupta | last post by:
Here i use image in background in table column it does not displays the image but if i apply the same path for img tag in foreground it displays. Here is code: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10438
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9042
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7540
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.