I have the following columns in my table: ID – NUMBER(10,0) NUMBER – VARCHAR(255) All data in the NUMBER column are numbers. I would like to change the VARCHAR type to Integer Number type. How to do it without data loss? Answer Oracle does not allow modification of data type of the column if it is not empty so as
Tag: ddl
Nasty sql error(POSTGRES) “There is no unique constraint matching given keys for referenced table…”
EDIT: tables have been translated from my language to english i’ve changed te reference of foreign key in table Comment to “Utente” -> “User” Hi everyone i’m trying to build a small review system in sql as follows. Every user can comment on some item(could be anything) and any other user can answer any comment. The Admin of the website
Building table of unique sets
What I’m trying to do is build a table of unique sets of rows. What is the aim? I’m building an app for a service provider (let’s say cable company for example). Every customer has a set of …
#1005 – Can’t create table `musicplayer`.`Albums` (errno: 150 “Foreign key constraint is incorrectly formed”)
I’m trying to define some tables with SQL, but when I execute it I have an error. Below there is my code and the error which I receive. CREATE TABLE Artists ( id INT AUTO_INCREMENT PRIMARY …
Create database user with DDL in DB2
I am trying to create a user using DDL in DB2. I tried this: CREATE USER ‘test_user’ IDENTIFIED BY ‘password’; and I got this error message: An unexpected token “‘test_user’ IDENTIFIED BY ‘…
Way to alter one table if another was altered
For example, I am having table T1 and archive table T1_A Create table T1(n number); Create table T1_A(archieve_dt date,n number); To make activation working correctly if I am adding a column to T1 …
Using replace() inside a loop
I am trying to copy indexes from materialized views onto tables. This is the script I am trying to use: DO $$ declare indexdefname record; a text; b text; c text; begin for indexdefname in …
case statement in index creation
How do i use a CASE statement when creating a UNIQUE INDEX? My statement looks like this CREATE UNIQUE INDEX my_unique_creation ON junk ((CASE WHEN nlevel(path) > 1 THEN (…
ORA-04063: view has errors
I have 3 users (schemas) in my database. User A holds table X I created a view Y for user B and a view Z for user C. The views are identical: The first view works fine; for the second one I have the following error when trying to see data (from SQL developer): ORA-04063: view “User_C.Z” has errors. I
SQL Updating column after adding it giving “Invalid column name” error
I have the following SQL in SQL Server 2005 but I get an error stating “Invalid column name ‘ExpIsLocalTime’ (ln 7) when I run it: IF NOT EXISTS(SELECT * FROM sys.columns WHERE Name = N’…