Oracle development skills in the project

xiaoxiao2021-03-06  50

There is already more than a month to participate in the "Digital Bus" project. The module I am responsible for is basically completed and passed through the test. The project is based on Oracle's C / S structure, involving many database operations. Some experience is used before. In order to leave a day reference, the special record is recorded, if you see the reader of this article can be used, then I am more gratifying. 1.Users is the user table, the userid is the only order number from Sequence, as the primary key , each following trigger to facilitate the insertion of unique sequence distribution can also refer to other tables herein CREATE OR REPLACE tRIGGER users_trigbefore insert on usersfor each rowdeclare seq_val number; begin select s_userid.nextval into seq_val from dual;:. new.userid: = SEQ_VAL; END; 2.org is a department table, where orgid is the current department ID, PORGID is the superior directory ID, like this table with a parent-child relationship, uses a query from a certain or down for Oracle's Connect BY statement: select * from org connection by prior orgid = PORGID Start with orgid = 1 // From the department ID to 1 department for all sub-sectors Select * from org connection by prior porgid = orgid start with orgid = 1 // From department The department of ID is a department for all parent sectors 3. User, role, permission relationship handling the character of the character table, indicates 1 and 0, 1 indicates that there is no, if the system has 10 modules, each One character's permissions are indicated by 10 bits 01. The user is given role, and one user can have multiple characters, and the relative to the user's permissions is the result of the permissions of the role to do and operate. Strsql = "SELECT SUBSTR Power, "& Modid &", 1) As Rightbit from Role WHERE ROLLEID IN (SELECT ROLLID "where loginname = '" & strloginname "))" // lists the current user If you have a role, if there is 1 permission result of the current module The user has permission, and if it is 0, there is no permission.

转载请注明原文地址:https://www.9cbs.com/read-87908.html

New Post(0)