y at - it Systemtable of the data types of the column?
Is QUESTION 1 Systemtable of the data types of the column?_________________________________________________________________
QUESTION2
IF REGEXP_SUBSTR (p_datatype, "[''!" [¤ % & / =? *; >: <]') IS NOT NULL
We say: you can not write that! » ¤ % & / = ? ' ^ * ; >: <-each of each example ">".
How can I say... you can NOT write PENIS, NIPPLES, hole word "NIPPLES".
__________________________________________________________________
Published by: user619226 on 19-sep-2008 01:15
Do you mean something like this...
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_txt VARCHAR2(200) := 'FRED,JOE';
3 begin
4 IF regexp_like(v_txt, '^[[:alnum:]]*$') THEN
5 dbms_output.put_line('Text is OK as it contains just a word');
6 ELSE
7 dbms_output.put_line('Text is not OK. Must only contain a single word');
8 END IF;
9* end;
SQL> /
Text is not OK. Must only contain a single word
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_txt VARCHAR2(200) := 'FRED';
3 begin
4 IF regexp_like(v_txt, '^[[:alnum:]]*$') THEN
5 dbms_output.put_line('Text is OK as it contains just a word');
6 ELSE
7 dbms_output.put_line('Text is not OK. Must only contain a single word');
8 END IF;
9* end;
SQL> /
Text is OK as it contains just a word
PL/SQL procedure successfully completed.
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_txt VARCHAR2(200) := 'FRED JOE';
3 begin
4 IF regexp_like(v_txt, '^[[:alnum:]]*$') THEN
5 dbms_output.put_line('Text is OK as it contains just a word');
6 ELSE
7 dbms_output.put_line('Text is not OK. Must only contain a single word');
8 END IF;
9* end;
SQL> /
Text is not OK. Must only contain a single word
PL/SQL procedure successfully completed.
SQL>
Tags: Database
Similar Questions
-
How to declare the data type of a column in a select query?
How can we give the data type of each column on the fly during the selection of rows in a query?the cast function converts one data type to another.
The syntax of the cast function is:
Cast ({expr |}) (subquery) | (MULTISET (subquery)} AS type_name)
Select cast (22 August 2003 ' AS varchar2 (30))
Double;Published by: b_ * August 12, 2011 10:08
-
How to recover the data type of a column in a table?
Hello
I want to retrieve the data type of a column in a table. At the moment I'm querying attribute 'OCI_ATTR_DATA_TYPE', but it is SQLT_CHR varchar2 and nvarchar2 data type columns. I need to make a distinction between these columns of two separate data types. Y at - it all API through which I could get the exact data type of a column, i.e. "nvarchar2?
Thanks in advance.
HashimHello
It is not a very direct way to do it. What you can do is to call OCIDescribeAny on the table that you want to get information. You can then get the OCI_ATTR_CHARSET_FORM attribute for the column. If the value of the attribute that you get is SQLCS_IMPLICIT, that would mean its a varchar/char/varchar2 column regular. If you get SQLCS_NCHAR, this means that the column is NCHAR. You can get the example of it here:
http://download.Oracle.com/docs/CD/B14117_01/AppDev.101/b10779/oci06des.htm#446491
Just look for the section "Recovering for a Table column Datatypes".
Thank you
Sumit -
Display the data type of a column in the status bar
Hi all
n pl/sql developer, when I select a column in a table.
If I clicked with the mouse on the column in the query results box, it shows me the type of data and the size of the column in the status bar
Developer SQL does not by default,
is there an option I can change to do the same task?
Thank you
No, you will need to open a popup DESC of the query to see the data types of the data returned.
-
How can I find what is the data type of a column of a Table in oracle or SQL?
(a) what happens if I want to know the type of data in a specific column in the Table.
(b) how to find the column data types?
Can someone help me please. I am new to oracle and try to learn a few tricks
Hello
How to do
SQL > desc
SQL> desc emp Name Null? Type ----------------------------------------- -------- ---------------------------- EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2)
-
change the data type of a column
Since the previous post: how to change the data type of column number to varchar2 in oracle10g
Measures may be:
create table TestTable (ColA varchar2 (5));
Insert into TestTable values('12345');
ALTER table TestTable Add (ColATemp number (5));
setting a day of TestTable set ColATemp = ColA;
ALTER table TestTable remove column ColA;
change the column in table TestTable rename ColATemp CLC;
My question is:
If the table half million records
setting a day of TestTable set ColATemp = ColA;
will it be a good solution? Any performance issues? There is no index on this column.Sort while you do DDL, you will not be able to do any operation on the table. You the best suites you. It's a time operation, you can change the table to change the data type, but it may not work if some of the data in the table confirms no new data type of column.
Concerning
-
length of the data type of a column
Hello
I would like to know if it is possible to find the length of the
data type in a create table stmt.
For example:
create employee table (empno number (3), empname varchar (10));
in the DDL above I mentioned the size of my 3 number data type.
is there a way to retrieve this info. ?
outside desc < table_name >?
Thanks in advanceSQL> create table employee(empno number(3),empname varchar(10)) 2 / Table created. SQL> select column_name 2 , data_length 3 , data_precision 4 , data_scale 5 from user_tab_columns 6 where table_name = 'EMPLOYEE' 7 / COLUMN_NAME DATA_LENGTH DATA_PRECISION DATA_SCALE ------------------------------ ----------- -------------- ---------- EMPNO 22 3 0 EMPNAME 10 2 rows selected.
Details on the columns can be found in the documentation: http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2094.htm#I1020277
Kind regards
Rob. -
How to change the data type of a column after the creation of the table
It comes to my table desc
SQL > desc job1
Name Null? Type
----------------------------------------- -------- ----------------------------
JOB_CODE NOT NULL VARCHAR2 (3)
JOB_CLASS VARCHAR2 (30)
CHG_HOUR NUMBER (5.2)
OVERTIMECHARGE NOT NULL NUMBER
I want to change column CHG_HOUR to store numbers up to 12 digits in length (including the decimal points).
I tried the following and it did not help
SQL > alter table job1 change column chg_hour number (6.6);
ALTER table job1 change column chg_hour number (6.6)
*
ERROR on line 1:
ORA-01735: invalid option of ALTER TABLE
SQL > alter table job1 change chg_hour number (6.6);
ALTER table job1 change chg_hour number (6.6)
*
ERROR on line 1:
ORA-01438: value larger than the precision specified for the column
where I'm going wrong?
Hello
I want to change the CHG_HOUR column to store numbers up to 12 digits in length (including the decimal points).
I tried the following and it did not help
ALTER table job1 change chg_hour number (12.6);
-
How to write the xml content of a file (Blob data Type) with other columns in file system
Team,
We are currently working on oracle 11 g. Suppose that we consider the SCOTT. EMP table for our creation of the table.
All existing columns of SCOTT along. EMP table allows to assume that this table has an additional column name emp_xml, which is of TYpe of BLOB data and it holds xml data.
the size of the data blob for each record in this col is greater than 32 KB (normally about 1 GB), now I want to write the contents of this column along
with enmae, empno, hiredate into an external file. Assume that if we are only to the BLOB column that is emp_xml then the code below worksStart
for c in (select emp_xml from your_table)
loop
dbms_xslprocessor.clob2file (emp_xml.getclobval (), 'YOUR_LOCATION', 'YOUR_DYNAMIC_FILENAME')
end loop;
end;but I want empno, enmae, hiredate with blob emp_xml written in the external file. Any assistance in this case welcome.
Concerning
max_linesize
Maximum number of characters for each line, including the newline character,
for this file (minimum 1, maximum value 32767). If not specified, Oracle
provides a default value of 1024.Defines how much you can read or write to a single call. I have to loop through the clob object and I write a pieces of 1024. So there is no limit to how much she can write. Just test it, IT will WORK!
-
the number (use of space) data type
Hi guys,.
Just a query.
I have a table with a data type of existing column - number (2).
If I change it to number (8), it will take an extra space if the inserted values are from 2-digit?
Any URL to reference?
Thank you
I have a table with a data type of existing column - number (2).
If I change it to number (8), it will take an extra space if the inserted values are from 2-digit?
Any URL to reference?
No - the amount of space takes a NUMERIC value is based ONLY on the actual value you store.
You can store 20 numbers that don't take no more space than would a number to two digits.
Do not believe? Then just store values in a column NUMBER then question the values and the values of DUMP (myColumn) out and see how the actual duration and the internal representation. The value '12300000000000' will not take any space more than the value "123" since the number of SIGNIFICANT digits is the same.
See my response in this thread of the year last for details and sample data.
See the programmer's Guide of the OIC for details on how MANY values are stored internally.,.
http://docs.Oracle.com/CD/E11882_01/AppDev.112/e10646/oci03typ.htm#sthref426
Oracle database stores the values of the
NUMBER
data type in a variable length format. The first byte is the exponent and is followed by 1 to 20 mantissa bytes. The high bit of the exponent byte is the sign bit; It is defined for positive numbers, and it is cleared for negative numbers. The lower 7 bits represent the exponent, which is a number of base-100 with an offset of 65.To calculate the decimal exponent, add 65 to the exponent of base-100 and add another 128 if the number is positive. If the number is negative, do you the same thing, but eventually the bits are inverted. For example,-5 has an exponent of base-100 = 62 (0x3e). The decimal exponent is therefore (~ 0x3e)-128-65 = 0xc1-128-65 = 193-128-65 = 0.
Each byte of the mantissa is a base-100 digit, in the 1,100 range. For positive numbers, the digit has 1 added to it. Thus, the number of mantissa for the value 5 is 6. For negative numbers, instead of adding 1, the digit is subtracted from 101. Thus, the digit of the mantissa of the number - 5 is 96 (101-5). Negative numbers have a byte containing 102 appended to the data bytes. However, negative numbers with 20 mantissa bytes do not have byte 102 end. Because the digits of the mantissa is stored in base 100, each byte can represent 2 decimal digits. The mantissa is normalized; zeros are not stored.
Up to 20 data bytes can represent the mantissa. However, only 19 are guaranteed to be precise. 19 data bytes, each representing a base-100 digit, give a maximum precision of 38 digits for an Oracle
NUMBER
. -
Cannot change the type of data in the columns referenced by foreign keys
Hello:
I'm using Version 3.1.0.691 and change the types of data in many columns of data derived from the field types. If a column is referenced by a foreign key, however, the data type radio buttons are grayed out. I suppose that if I deleted the foreign key, that I would be able to change the data type of the column to a field, but that would be tedious. Is there another way to go about this?
Any help would be greatly appreciated.
Thank you
DocHi Doc,
If a column is referenced by a foreign key, however, the data type radio buttons are grayed out.
It is not good - if you have the PK column, and it is called by another FK column you can change the data type of column PK and FK column data type will follow the change. You cannot manually change the data type of column FK. Good column PK itself could relate to another column, and in this case you cannot change the data type of column PK.
In your case - you need to find the first PK/Uk column that is not the column FK itself and change its data type. FK columns in the chain will follow.Philippe
-
Change data type for the column in a table - Oracle 8i
Team,
I need to change a VARCHAR2 column in number.
ALTER table xyz change number abc;
By giving the above statement, it says I need empty this column before you change.
I can't change the data type before emptying this column.
Please indicate any other solution. Give me some suggestions.
Empty the column for me here BIG task.user11081688 wrote:
I can't change the data type before emptying this column.Not according to the documentation:
You can change the data type of any column or decrease the size of the entire column if all rows in the column contains NULL values.
Please indicate any other solution. Give me some suggestions.
You can add another column with the correct data type.
ALTER TABLE xyz ADD COLUMN def NUMBER; UPDATE TABLE xyz SET def = TO_NUMBER(abc); ALTER TABLE xyz DROP COLUMN abc; ALTER TABLE xyz ADD COLUMN abc NUMBER; UPDATE TABLE xyz SET abc = def; ALTER TABEL xyz DROP COLUMN xyz;
If I remember correctly, Oracle 8i does not support the change of name of column if this solution is a bit more complicated than 9i and above. Another option would be to create a new table with CREATE TABLE AS... SELECT, drop the old one and rename a new one to the old.
-
Problem with the DATA types, in a UNION
Hello
I m trying to disply a custom message when no data found using the structure below. Unfortunately I ve you have a problem with the data types I im trying to union
I tried different types of data in the 2nd SELECTION tool but the rest of the problem. Help, please.
SELECT HOSP_NAME 'HOSPITAL' DOC_SUR 'NAME', 'NAME' DOC_NAME, d.DOC_ID ID, diagnosis
H., DOCTOR d, (SELECT d.DOC_ID, COUNT (d.DIAGN_ID) diagnosis
OF PATIENT_DIAGNOSIS d
GROUP BY d.DOC_ID)
WHERE diagnosis > 1
UNION ALL
SELECT TO_CHAR ('test'), TO_CHAR ('test'), TO_CHAR ('test'), TO_CHAR ('test'), 0
OF THE DOUBLE
If NOT EXISTS (HOSP_NAME 'HOSPITAL' 'NAME' 'NAME' DOC_NAME DOC_SUR, d.DOC_ID ID, diagnosis
OF ΝΟΣΟΚΟΜΕΙΟ h, ΙΑΤΡΟΣ d, (SELECT d.DOC_ID, COUNT (d.DIAGN_ID) diagnosis
OF PATIENT_DIAGNOSIS d
GROUP BY d.DOC_ID)
WHERE diagnosis > 1);
ORA-01790: expression must have same type of data, matching expression
01790 00000 - "expression must have the same type of data, matching expression.DOC_SUR 'NAME' DOC_NAME 'NAME', ID d.DOC_ID, HOSP_NAME "HOSPITAL", diagnosis
What is the data type for these columns
To_char('test'), to_char ('test'), to_char ('test'), to_char ('test'), 0
What you're doing here 'test' is already a character. Why do you use TO_CHAR?
-
determination of the data type of an existing column in a table
Hello
I did some googling on this, and I know I've done it before, but I can't find / remember how to determine the data type of a column in an existing table... I have tried select dump (column_name) table, but it didn't work.
any suggestions?
Thanks in advancedata type field in
select * from user_tab_cols where table_name=
and column_name= Ravi Kumar
-
If I change the data type of a column, and there were no other structural changes, I have indeed flashback the table to one point more old if I first return they datatype its original definition?
I would like to try it myself, but I messed up somewhere and disabled my return of flame somehow... maybe for the current session or the entire database, I need to see what is wrong - for now I would like to continue my current reading instead of playing with that.
Assistance regarding the issue is appreciated, thanks.
This should answer your question:
http://docs.Oracle.com/CD/B28359_01/server.111/b28286/statements_9012.htm
FLASHBACK TABLE
Goal
Use of the
FLASHBACK
TABLE
statement to restore a previous state of a table in the event of human error or application. The time in the past including the table can be flashed back is dependent on the amount of undo data in the system. Also, Oracle database cannot restore a table to an earlier state across all DDL operations that modify the structure of the table.See that last sentence?
-
change the type of a column in a view column
Hi all
I have a visibility.
CREATE or REPLACE FORCE VIEW veh (wine,
last_nm,
first_nm,
city_nm,
model_yr,
veh_indctr
)
AS
SELECT vs.vin, p.last_nm, p.first_nm, p.city_nm, vs.model_yr,
(CASE
WHEN vs. TYPE IN ('TEST', 'RECYCLE')
THEN 'Y '.
ANOTHER "N".
Veh_indctr END)
VEHICLE vs, person p
WHERE vs.vin = p.vin;
Here veh_indctr is not any table, so I want to set the data type for this column.
Type column must be VARCHAR2 (1)
How can we do that... Please advise on this
Thanks in advance
Published by: user1692585 on April 15, 2013 06:19What is the current of this column data type when you create the view...
In any case, you could use CAST
cast ( CASE WHEN vs.TYPE IN ('TEST', 'RECYCLE') THEN 'Y' ELSE 'N' END as varchar2(1) ) veh_indctr
Maybe you are looking for
-
How to delete a contact on Apple Watch
How to remove a contact stored on the iwatch?
-
HP Support Assistant required Action
I have the HP Touchsmart all-in-one with Windows 7. The HP Support Assistant in my taskbar is rechaussaient a white exclamation mark in a red circle that says need of Action Important. When I click on the companion of HP and he opens it shows every
-
While Tecra A2 shut downs message appears - TMEEJM_Wnd cannot be closed
Have a Tecra A2 purchased in March 2005. I reinstalled the system successfully. When I try to shut down the system of windows open one after another with the message: "TMEEJM_Wnd cannot be closed." I have the ability to immediately close or cancel. W
-
I'm looking for a replacement for the headphone jack. It starts to become staticky. Is it possible to get these pieces of Motorola?
-
I just got my Pro-100 and set up, but I can't figure out how to get the network settings. I printed the network configuration page and it shows that my ethernet is disabled. Where can I enable and whee do configure ethernet and wifi settings? I have