Minimalistic Oracle contains a collection of practical examples from my encounters with Oracle technologies.
When relevant, I also write about other technologies, like Linux or PostgreSQL.
Many of the posts starts with "how to" since they derive directly from my own personal experience.
My goal is to provide simple examples, so that they can be easily adapted to other situations.
Friday, December 2, 2022
How to alter a column to use a sequence generated number
In my example, mytable contains a columnn called id, which is of datatype bigint.
If you want to use a sequence to automatically popluate the column at each insert, you can alter the column to support this with the below syntax:
ALTER TABLE myschema.mytable
ALTER COLUMN id SET DEFAULT nextval('myschema.mysequence'::regclass);
No comments:
Post a Comment