473,842 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Linking of Schemas

19 New Member
Hello,

Is there anybody can help me on how can I make an auto number across all my 15 schemas. I need to create it for tagging of my equipment.

Thanks,
Jam
Nov 13 '08
60 4649
Pilgrim333
127 New Member
You can do it by creating a row level trigger on all the tables that need the sequence as numbering. In the trigger, get the next value from the sequence and put it in the apropriate column, overwriting any value inserted. If you have a lot of tables, it will be a lot of work. But then you are sure that the right value of the sequence will be used.

Pilgrim.
Nov 19 '08 #41
jam26
19 New Member
Wow! does it mean if I have 15 schemas, it will be 15 tables? Can you teach me how to do that please.

Thanks.
Nov 19 '08 #42
Pilgrim333
127 New Member
Well, If you have more table per schema that use the sequence then it will be more tables.

Here is some more info on triggers, and there even is an example of how to use the sequence for a table key. Experiment with it and if you have any questions, just ask.

Triggers

Pilgrim.
Nov 19 '08 #43
jam26
19 New Member
Ok I will check this. Is it true that the trigger is risky to use?

Thanks.
Nov 19 '08 #44
Pilgrim333
127 New Member
Risky in what way? You just have to be sure that the code does exactly what you want. Test it good before implementing it in production.

Pilgrim.
Nov 19 '08 #45
amitpatel66
2,367 Recognized Expert Top Contributor
Wow! does it mean if I have 15 schemas, it will be 15 tables? Can you teach me how to do that please.

Thanks.
You need to find how many tables are being used in each schema after which you can decide on what can be done. Ofcourse having lots of triggers is not advisable
Nov 19 '08 #46
Pilgrim333
127 New Member
He means lots of triggers per table. If you have a few triggers per table, that is acceptable.

Pilgrim.
Nov 19 '08 #47
amitpatel66
2,367 Recognized Expert Top Contributor
He means lots of triggers per table. If you have a few triggers per table, that is acceptable.

Pilgrim.
I understood what @OP said and I had explained him.

@OP,

Its question of, if there are 10 tables in each schema used by application, then 10 * 15 = 150 tables and creating 150 triggers one each for a table is ofcourse not smart way of implementing.

And again you are going to connect to database from an application, and insert a record in the table which in turn will fire a trigger. So you need to make sure if this way you are reallly getting unique value and not the old value.
Nov 19 '08 #48
Pilgrim333
127 New Member
@OP

The whole idea of the trigger is that the trigger will fetch from the sequence and not the application. The unique values should not be a problem.
The whole idea of triggers is that, no matter from which interface you want to access the tables, everything is done on the database side, so the interface need not worry about unique values, bussiness rules etc. This is the Oracle way of solving the problem you are encountering.

As i stated before, he has to test the code in the trigger before implementing. Furthermore, if you have a system that has 150+ tables, then 150+ triggers should be no problem at all. If it is, then your system is way too big for your budget.

Pilgrim.
Nov 19 '08 #49
amitpatel66
2,367 Recognized Expert Top Contributor
@OP

The whole idea of the trigger is that the trigger will fetch from the sequence and not the application.
Ofcourse the application is going to connect to the database and perform some insert so that the trigger gets invoked. If there was no application at all then the sequence was working perfeclty from sqlplus


As i stated before, he has to test the code in the trigger before implementing. Furthermore, if you have a system that has 150+ tables, then 150+ triggers should be no problem at all. If it is, then your system is way too big for your budget.
Budget does not come in to play here. The application is already available. It need to be customized by including the functionality of having a auto number generation across multiple schemas of a database. And yes why not an application have more than 150 tables if there are 15 schemas involved. Its just an assumption and nothing else which can be clarified if @OP answers the question of letting know to how many tables are used in each schema by the application.
Nov 19 '08 #50

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

Similar topics

0
1426
by: kyancy | last post by:
Hello All. We have several XML schemas to describe common component document parts. We then create new XML schemas as necessary that use "xsd:import schemaLocation=whateverLocation.." to include the common type definitions from 1 or more of the component XML schemas rather than just explicitly adding the common definitions in every XML schema we create. This works great from a definition and validation point of view, but I
30
9860
by: btober | last post by:
Whenever I create a temporary table, with something like CREATE TEMPORARY TABLE temptable1 AS SELECT * FROM paid.ad_hoc_query; New schemas appear, with names like "pg_temp_1". I guess the appearance of these schemas with "temp" in the name indicates that they are "temporary" schemas and related to the temporary table creation, but the schemas persist even after the end of the session in which the temporary table was created.
7
1610
by: Roderick A. Anderson | last post by:
I'm looking for some input on a configuration I'm implementing. The long term goal is to providing hosting for companies and organizations with a basic/generic set of applications that use PostgreSQL. Most of these applications want to be installed in their own database. Given I'm looking at 6 or so already this would be 6+ databases per company. Not my idea of an easy to admin situation. My plan is to make one database (per...
4
1694
by: anonymous | last post by:
When I use the schema collection to apply many schemas to one XML instance document, I get an error if I do not qualify every element with the appropriate namespace. Both the W3C site and this article (http://www.xfront.com/ZeroOneOrManyNamespaces.html) imply that I can submit an XML instance without having to qualify each element. How do I accomplish this while still using .Net & the
2
1286
by: John Jenkins | last post by:
Hi, I have a lot of schemas to load into a schema collection. I load them in by reading each one into a XMLTextReader from disk and add them into a schema collection. I have a couple of issues to contend with. 1. The targetnamespace on all the schemas (except ones which define generic types) are the same. 2. The DefaultNamespace is the same as the Targetnamespace (I think this should be ok) 3. Some of the schemas import other sschemas...
0
2251
by: gasturbtec | last post by:
please help im new at access programming and i just got this project dropped in my lap because the old programmer quit. i've been doing ok so far but now i need to add code to an existing database that is used to connect to other databases and generate reports. below is sample code of how the database does the linking i hope i give you enough info to help me but if not let me know and i will give more. Sub txtShipDataFileSub() Dim...
1
1587
by: CSN | last post by:
I have two machines between which I exchange dumps a lot. On the first (Windows/cygwin), pgsql was set up with "Administrator" as the main superuser - who owns all schemas in template0 and template1. On the second machine (Linux), "postgres" is pgsql's main superuser. On whatever machines I do "createdb", the owner of the schemas in template0/1 is copied over to the schemas in the new database, even when specifying the owner parameter...
6
3537
by: Dennis Gearon | last post by:
This post is as much about getting some questions answered as leaving the following definitions in the archives for the next person. After a quick perview of the web, I came up with the following: tablespaces are a hardware issue, and totally transparent to SQL execution. It is for optimization for IO, recovery, and separating user and application usage amongst disks even in the same databases. schemas are a logical issue, and NOT...
3
4631
by: Sami Marzouki | last post by:
Hi, What I'm trying to do is: - To write a Web.config with custom sections. (Done) - To write a xsd schema for this custom sections.(Done) - Tell the Web.config to take the two schemas. When i specify the two schemas in the schemas property of the web.config, it seems that only one is token.
0
9715
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
10610
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9452
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
7855
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
7035
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
5884
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4499
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
2
4088
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3142
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.