473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Alter Command

I need to alter a column in a table by the type so that the price is reduced by 3%. Can anyone give me any ideas on how to do this.

SQL> ALTER TABLE FICTION
2 MODIFY (PRICE)
3 WHERE PUBLISHER_CODE = 'PE' AND
4 HAVING (SUM(PRICE * .03)-PRICE)
5 ORDER BY PRICE;
This is what I have but it gives me an error message.
Thanks
Feb 15 '07 #1
2 2391
michaelb
534 Expert 512MB
I have to guess that what you really want here is not to alter the table, but to change some values.

If this is the case, you could use something like this:

Expand|Select|Wrap|Line Numbers
  1. UPDATE TABLE FICTION SET PRICE = PRICE * 0.97
  2. WHERE PUBLISHER_CODE = 'PE';
  3.  
Feb 16 '07 #2
debasisdas
8,127 Expert 4TB
If u want to change the value why u need to alter
Alter is a DDL. It is only used to change the structure not the data.
Since your requirment is to change data not structure use the simple update command

SQL>UPDATE TABLE FICTION SET PRICE = PRICE * 0.97
WHERE PUBLISHER_CODE = 'PE' ;.
Feb 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: jarednevans | last post by:
How does one capture the result status of an ALTER command inside plpgsql code block? For example: ----------------- CREATE OR REPLACE FUNCTION public."Setup_Primary_Keys"() RETURNS SETOF...
10
by: Jane | last post by:
Does any one know why this statement is failing? db2 => ALTER TABLE ELMT_T ALTER COLUMN CDTY_CD SET DATA TYPE VARCHAR(51) DB21034E The command was processed as an SQL statement because it was...
10
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
5
by: minjie | last post by:
Is it possible to run a simple script to alter a table column in Access database from an interger to a double? I have been writing C++ programs every time we need to upgrade (modify) the Access...
1
by: vasilip | last post by:
I'm testing out db2 for a project I'm starting that requires proper xml support and I can't seem to get both xml and spatial data to work well in the same table. Once having created a table...
3
by: Gregor Kovač | last post by:
Hi! I have a table with a column of BIGINT and I want to change the type to SMALLINT. Command ALTER TABLE TABLE1 ALTER COLUMN COL1 SET DATA TYPE SMALLINT does not work since I cannot specify...
3
by: Rahul B | last post by:
Hi, I have a user UCLDEV1 which is a part of staff and a group(db2schemagrp1) to which i have not given any permissions. The authorizations of that user are shown as db2 =get authorizations...
2
by: sjping | last post by:
This is what I did: >db2 alter table C1016781_T1 alter column itemContent set data type blob(2097152) and I got: DB21034E The command was processed as an SQL statement because it was not a...
3
by: BD | last post by:
Hi, folks. Sorry about this - I have been R'ing all TFM's I can find, but am just getting more frustrated. Background: db2 UDB 8.1 on Windows. I'm quite new to db2, but have several...
0
by: ccoq | last post by:
I received the below error message when I ran this command ALTER TABLE WAC.SUPPRESSED_CUSTOMER ALTER COLUMN CUSTOMER_ID SET DATA TYPE VARCHAR(28) DB21034E The command was processed as an SQL...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...

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.