473,811 Members | 2,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modelling Oracle Sequences

Hi,

I am in the process of porting a number of large MSSQL databases to
Postgres.

The current id generation model in SQL server is an oracle style sequence
generator i wrote using a pretty simple stored proc and table structure.

I now need to do the same thnig in postgres.

In MSSQL I was able to open an UPDATE cursor, which places a lock on the row
in the sequence table. I then update, release and return.

Has anyone done something similar or have any pointers on how to do this
safely, securely without an update cursor?

Any infor appreciated.

Cheers,

Julian.

_______________ _______________ _______________ _______________ ____________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
_______________ _______________ _______________ _______________ ____________

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
2 1531
Hello

why can't use normal sequence? There isn't difference betwen Oracle and
PostgreSQL?

http://www.postgresql.org/docs/7.3/s...esequence.html
regards
Pavel

On Fri, 21 Nov 2003, Julian North wrote:
Hi,

I am in the process of porting a number of large MSSQL databases to
Postgres.

The current id generation model in SQL server is an oracle style sequence
generator i wrote using a pretty simple stored proc and table structure.

I now need to do the same thnig in postgres.

In MSSQL I was able to open an UPDATE cursor, which places a lock on the row
in the sequence table. I then update, release and return.

Has anyone done something similar or have any pointers on how to do this
safely, securely without an update cursor?

Any infor appreciated.

Cheers,

Julian.

_______________ _______________ _______________ _______________ ____________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
_______________ _______________ _______________ _______________ ____________

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 12 '05 #2
Julian North wrote:
Hi,

I am in the process of porting a number of large MSSQL databases to
Postgres.

The current id generation model in SQL server is an oracle style sequence
generator i wrote using a pretty simple stored proc and table structure.

I now need to do the same thnig in postgres.

In MSSQL I was able to open an UPDATE cursor, which places a lock on the row
in the sequence table. I then update, release and return.

Has anyone done something similar or have any pointers on how to do this
safely, securely without an update cursor?


Are you trying to do this?

http://developer.postgresql.org/docs...-sequence.html

Sequence values are transaction safe in postgreql. You don't have to lock
anything to get a correct and unique sequence value.

HTH

Shridhar
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #3

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

Similar topics

38
25123
by: Mike | last post by:
No flame wars, please! We're planning a move from a non-relational system to a relational system. Our choices have been narrowed to Oracle and DB2. Since we're moving from non-relational to relational, then we're not currently using any relational-type operators. So I expect the end result to use simple, SQL standard commands and queries. The question: At the SQL standard level is there any
125
15519
by: Rhino | last post by:
One of my friends, Scott, is a consultant who doesn't currently have newsgroup access so I am asking these questions for him. I'll be telling him how to monitor the answers via Google Newsgroup searches. Scott has heard a lot of hype about DB2 and Oracle and is trying to understand the pros and cons of each product. I'm quite familiar with DB2 but have never used Oracle so I can't make any meaningful comparisons for him. He does not have...
4
2012
by: golu | last post by:
Has any body done the porting from oracle to sql server, what were the issues in porting the data bases? Also suggest some resources which can be helpful in the porting project TIA Golu
5
6091
by: berj | last post by:
Is it possible to access an Oracle sequence by using ODBC in MS Access? I have been able to link to the Oracle tables, but need autonumbering and I am not able to change the column properties. Thanks!
42
6763
by: Paul | last post by:
Anyone know where I can find some good resources to help us choose between SQL and Oracle ( Progress Openedge as well ) . Any comments on what you would choose ?? We are creating a new Warehouse Management System which wil manage our very large inventory. Anyway comments suggestions welcome Thanks Paul
2
14255
by: Vinod Sadanandan | last post by:
All, Below listed are the new features in Oracle 11g ,please join me in this discussion to generate a testcase and analyze each of the listed features . Precompilers: Additional Array INSERT and SELECT Syntax Support by Pro*C/C++ and Pro*COBOL Precompilers: Dynamic SQL Statement Caching in Pro*C/C++ and Pro*COBOL Precompilers: Fix Execution Plan in Pro*C/C++ and Pro*COBOL Precompilers: Flexible B Area Length...
0
3486
debasisdas
by: debasisdas | last post by:
PL/SQL: Sequences ================ In Oracle, the sequences object provides a sequential series of numbers to applications without the overhead of disk I/O or transaction locking. These values are often used for primary and unique keys. In the previous release of Oracle Database, You can refer the sequence values in SQL statements with following pseudocolumns: CURRVAL returns the current value of a sequence. NEXTVAL
0
2261
by: mail2sanand | last post by:
Hi all, I am facing a new issue with oracle and rails. I feel rails is expecting a sequence name associated with all the tables. The actual question is that how can we make rails understand that there is no sequence associated with a model. Coz when I am running RSpecs for some models (connected to oracle database) without sequences, Itz giving an error that ...
0
9607
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
10652
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...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9211
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
7673
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
6895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5561
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
4346
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
3026
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.