3 level authorization table structure
Hi ,
I have an application, I want add a feature of maker,checker and authorize for every record in a table. I am explaining in below details.
Ex : -
Suppose I have one table called Employee table. There are 3 users are there. one is maker, 2nd one is checker and last one is authorize person. So when 1st user creates an employee record in database then this record is not live means
this record can not be used in any transaction. Once checker is checked and authorize user is authorized this record will go live. Same thing is applicable for update and delete also. So I want a table structure how to achieve this in real time. I have designed
a structure but I need a reliable and simple design. Please advice if any.
Looks like you need a single column to identify the type of user (M,C or A) Much better this scenario described here
http://vyaskn.tripod.com/row_level_security_in_sql_server_databases.htm
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence
Similar Messages
-
Error during transport-Structure change at field level (convert table /BIC)
Hi,
I am trying to transport from DEV to Test when I encountered this error.
The tables are both consistent when I checked with SE14.
Start of the after-import method RS_CUBE_AFTER_IMPORT for object type(s) CUBE (Activation Mode)
Error/warning in dict. activator, detailed log > Detail
Structure change at field level (convert table /BIC/DZCRUSDI026)
Table /BIC/DZCRUSDI026 could not be activated
Return code..............: 8
Following tables must be converted
DDIC Object TABL /BIC/DZCRUSDI026 has not been activated
Error when activating InfoCube ZCRUSDI02
Error/warning in dict. activator, detailed log > Detail
Structure change at field level (convert table /BIC/DZCRUSDI023)
Structure change at field level (convert table /BIC/FZCRUSDI02)
Table /BIC/DZCRUSDI023 could not be activated
Table /BIC/FZCRUSDI02 could not be activated
Return code..............: 8
Following tables must be converted
DDIC Object TABL /BIC/DZCRUSDI023 has not been activated
Error when resetting InfoCube ZCRUSDI02 to the active version
How do I resolve this
thanksHi,
There are no Inactive objects in the cube in DEV system. Also must of the changes I made in Test are already in the cube in TEST But the cube is not active.
SAP proposed that the cube be activated manually but is not a good procedure to activate in TEST system.
Error when resetting InfoCube ZCRUSDI02 to the active version
Message no. RSO410
Diagnosis
Errors arose when activating InfoCube ZCRUSDI02. An active version already existed before the activation.
System Response
InfoCube ZCRUSDI02 could not be reset to the old active version. Since the generated objects no longer correspond to the old active version, they were reset to inactive.
Procedure
The old active version of InfoCube ZCRUSDI02 can no longer be used. Remove the cause of the activation error and activate InfoCube ZCRUSDI02 anew.
thanks -
Export and import only table structure
Hi ,
I have two schema scott and scott2. scott schema is having table index and procedure and scott2 schema is fully empty.
Now i want the table structure, indexes and procedure from scott schema to scott2 schema. No DATA needed.
What is the query to export table structure, indexes and procedure from scott schema and import in scott2 schema.
Once this done, i want scott schema should have full access to scott2 schema.
Oracle Database 10g Release 10.2.0.1.0 - 64bit Production
Please help...Pravin wrote:
I used rows=n
it giving me below error while importing dump file:-
IMP-00003: ORACLE error 604 encountered
ORA-00604: error occurred at recursive SQL level 1
ORA-01013: user requested cancel of current operation^CYou are getting this error because you hit "Ctrl C" during the import, which essentially cancels the import.
IMP-00017: following statement failed with ORACLE error 604:
"CREATE TABLE "INVESTMENT_DETAILS_BK210509" ("EMP_NO" VARCHAR2(15), "INFOTYP"
"E" VARCHAR2(10), "SBSEC" NUMBER(*,0), "SBDIV" NUMBER(*,0), "AMOUNT" NUMBER("
"*,0), "CREATE_DATE" DATE, "MODIFY_DATE" DATE, "FROM_DATE" DATE, "TO_DATE" D"
"ATE) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 6684672"
" FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "DMSTG" LOGG"
"ING NOCOMPRESS"Srini -
Direct database data access without data level authorization check
Hello,
My customer raised issue about direct database data access. Due to the customeru2019s strong security policy, it shouldnu2019t be allowed.
To prevent this kind of illegal data access, customer ask me to list up all the possibilities to display data without data level authorization check.
The things in my mind are
SQL Command Editor (for Oracle based system) : ORASPACE, DB02, ST04
Query Based : SQVI (Quick Viewer), SQ01/SQ02/SQ03 (SAP Query)
Data Browser : SE11, SE12, SE16, SE16N, SE17
Table Maintenance : SM30
Function Module : RFC_READ_TABLE
Function Module : DB_EXECUTE_SQL (DML)
Anyone knows anything which is not listed above?
ThanksHI,
Generally in production user's should not be given all these authorizations.
Ram. -
Determining internal table structure dynamically
Hi,
I have a number of internal tables in my program which I declare using types. As an example:
TYPES: begin of ty_hierarchy,
control_id(6) type c,
node_id(10) type c,
node_name type bezei40,
material type matnr,
node_level type prodh_stuf,
node_parent(10) type c,
end of ty_hierarchy.
DATA: it_hierarchy type ty_hierarchy occurs 0.
Further down my program I need to determine the structure of internal table IT_HIERARCHY dynamically. Because I have a number of internal tables, I need to determine which internal table is being processed. Therefore it's important that I know the structure of the table that I'm currently processing.
I am aware of CL_ABAP* classes and functions like GET_COMPONENT_LIST. However because I have declared my tables using the TYPE statement the method/function cannot read my table structure correctly. If I changed my declaration to be as below, the method/function work! However I don't want to do this as I use field symbols to reference my internal tables and need to use the TYPE statement.
DATA: begin of ty_hierarchy,
control_id(6) type c,
node_id(10) type c,
node_name type bezei40,
material type matnr,
node_level type prodh_stuf,
node_parent(10) type c,
end of ty_hierarchy.
DATA: begin of it_hierarchy occurs 0.
include structure ty_hierarchy
DATA: end of it_hierarchy.
Does anyone know on how I can determine my internal table structure dynamically but still keeping my internal table declarations using TYPE statement?
Any help would be greatly appreciated with reward points .....
Thanks
LiamHello Liam
Both the ABAP-OO as well as the FM-based approach described by Eswar work well with your way of defining the itabs. I described three different ways how to get the structure of your itab dynamically:
- directly using the itab
- using a field symbol
- using a data reference
REPORT zus_sdn_dynamic_itabs.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_hierarchy,
control_id(6) TYPE c,
node_id(10) TYPE c,
node_name TYPE bezei40,
material TYPE matnr,
node_level TYPE prodh_stuf,
node_parent(10) TYPE c,
END OF ty_hierarchy.
DATA:
gs_hierarchy TYPE ty_hierarchy,
it_hierarchy TYPE ty_hierarchy OCCURS 0.
DATA:
gt_comp TYPE abap_compdescr_tab,
gs_comp_a LIKE LINE OF gt_comp,
gd_type TYPE abap_typekind,
gs_comp TYPE rstrucinfo,
it_comp TYPE TABLE OF rstrucinfo.
DATA:
go_struct TYPE REF TO cl_abap_structdescr,
go_table TYPE REF TO cl_abap_tabledescr,
gdo_data TYPE REF TO data.
FIELD-SYMBOLS:
<gt_itab> TYPE table.
START-OF-SELECTION.
GET REFERENCE OF it_hierarchy INTO gdo_data.
ASSIGN gdo_data->* TO <gt_itab>.
* (1) Describe directly by using the itab
* go_table ?= cl_abap_structdescr=>describe_by_data( it_hierarchy ).
* (2) Describe indirectly by using field symbol
* go_table ?= cl_abap_structdescr=>describe_by_data( <gt_itab> ).
* (3) Describe by data reference to itab
go_table ?= cl_abap_structdescr=>describe_by_data_ref( gdo_data ).
go_struct ?= go_table->get_table_line_type( ).
WRITE: / 'ABAP-OO Version:'.
gt_comp = go_struct->components.
LOOP AT gt_comp INTO gs_comp_a.
WRITE: / gs_comp_a-name,
gs_comp_a-length,
gs_comp_a-type_kind,
gs_comp_a-decimals.
ENDLOOP.
SKIP 2.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = sy-repid
fieldname = 'GS_HIERARCHY'
TABLES
components = it_comp.
WRITE: / 'Function Module Version:'.
LOOP AT it_comp INTO gs_comp.
WRITE: / gs_comp-compname,
gs_comp-level,
gs_comp-leng,
gs_comp-type,
gs_comp-olen,
gs_comp-decs.
ENDLOOP.
END-OF-SELECTION.
Regards
Uwe -
Object level authorization for SLT Configuration schema in HANA DB
Hi All,
We have connected SLT with HANA DB (& ECC as source system).
Now for certain users we wanted to restrict the access for certain tables ( tables owned by SLT Schema, i.e schema created in HANA DB with the configuration name provided in the SLT configuration).
With the SYSTEM user object level authorization's of another schema is not possible hence , an error is thrown when we are trying to provide/control the access of single table for a user.
Is it ok that we generate a password for SLT schema and try login with schema owner. Is it the best practice or Is there any other way around.
Regards,
KumarHi Santosh,
You can find more info about SLT Roles and Authorization from below security guide.
http://help.sap.com/hana/SAP_HANA_Security_Guide_Trigger_Based_Replication_SLT_en.pdf
Regards,
V Srinivasan -
"Low-level" authorizations for accessing BW reports - add users to role
Using the advice in Topic "Low-level" authorizations for accessing BW reports, I have been able to publish a query to a role that has 3 test users and each user gets the same query but with different data, as determined in the tables.
Is there a way to look up the users and e-mail addresses from a table and associate them to the role? We have several hundred e-mail recipients that will not need BW access, but only need an e-mail with a static report that contains data on their own territories.Hi!
i think programatically it might be complex. You got to maintain a seperate variant of report per user and use this variant to send mail. that means you need to maintain a variant and a Broadcast setting per user. once maintained you can use it any number of times the values will be recalculated everytime.
with regards
ashwin
<i>PS n: Assigning point to the helpful answers is the way of saying thanks in SDN. you can assign points by clicking on the appropriate radio button displayed next to the answers for your question. yellow for 2, green for 6 points(2)and blue for 10 points and to close the question and marked as problem solved. closing the threads which has a solution will help the members to deal with open issues with out wasting time on problems which has a solution and also to the people who encounter the same porblem in future. This is just to give you information as you are a new user.</i> -
Hi Guys!!!
I have created a Z***** table n activated,now i want to change the data type from FLTP to CHAR but the thing is am getting an error "Structure change at field level (convert table Z******).what i supposed to do?
Warm Regards,
Mohandoss P.Hi,
Along with that message i think u will get 'ok' and 'delete' button will come..
please click on delete button.
but make sure that the table field is not using any where after deleting the table. other wise dependent programs will give dump.
Regards
Aravind. -
Problem displaying authorization Table SM30
Hi all
Hi
I am working on finding SAP Authorization object in ECC 6.0. When I went to Table SM30-- TSTC, I get the following message.
<b><u>View/Table TSTC can only be displayed and maintained with restrictions</u></b>
Can anyone please let me know How do I fix this problem. Or is there any other table that gives the information about authorization objects.
Thanks everyone.se11 gives info about authorisation objects and how to create them
sm30 is for maintaing tables. SAP tables are normally not accessed with sm30
if you want to view the fieldvalues from a table use tcode se16n instead
and if it is a z table look in se11 in the table structure about the restriction on the table
kind regards
Reward if usefull
arthur de smidt
Message was edited by:
A. de Smidt -
SM30 Field level authorization check
Hi,
I have a requirement to add the authorization check in SM30 for the company field in the custom table. Please suggest.
Thanks,
Gagan ChodhryHi,
I have this requirement for both type of tables i.e. custom as well as standard. Tables has got field profit center.. I need to show the table based on the loggedin user authorization to the profit center.
If it is a custom table then as mentioned by Siva, there is a way I heared that we can check the authorization in PAI event, but when I tried to do a small test, I could get the field symbol with the values, but I was not able to skip that record for disply.
If anyone can send the sample or the way to skip the record based on the check.
Also is there any other way to add the field level authorization to custom and standard tables...
Thanks,
Gagan Chodhry -
Copy Z table structure and contents
Hi all,
I am looking at a quick and easy way to copy a Z Table structure and its contents from
one system to another completely different system on different servers and locations.
Is this possible?
ThanksYes its possible Try to transport the request
The request should contain your required objects
Contact your basis admin he will do the transport the request from OS level.
Then Go and change the SID in the table TADIR
And Give the object name and change the SID of the object then it allows you to change as per the new requirement.
Hope This will help you.
Regards,
Madan Mohan. -
BI 7 : Command to export a table structure of SAP R/3 into a script/text ?
Hi All.
Greetings.
Am New to SAP R/3 system. And request help.
We are trying to pull data from SAP R/3 thro Bussiness Objects Data Services into Oracle.
For now : we create a target oracle table looking at the table structure of SAP R/3 from SE 11.
In BODS, We then do the query transformation, and use the oracle target table created by us manually.
This works absolutely fine.
We would like to know the command by which we could export the table structure of any existing table
in SAP R/3 into a script / or to text file,
which we could use to create the same table structure in oracle.
Rather than manually typing some 200 field names for each tables.
Can anyone advise on this.
Thanks
InduHello,
The problem is caused due to the spaces in your directories
C:\SAP Dumps\Core Release SR1 Export_CD1_51019634/DB/ADA/DBSIZE.XML
Replace the spaces with underscores and restart the installation from from scratch.
Cheers
Bert -
Hi,
I have a situation where i have to load data from one server/database table to multiple servers/databases.
Example:
I need to load data from dbo.TABLE_A (on Server: Server_A & Database: Database_A) to the same table on the list of server databases like
Server: Server_B , Database: Database_B
Server: Server_C , Database: Database_C
Server: Server_D , Database: Database_D
Server: Server_E , Database: Database_E
Server: Server_F , Database: Database_F
Server: Server_G , Database: Database_G
Server: Server_H , Database: Database_H
so on and so forth on 250 such server database combinations.
The table structure is the same on all the servers.
If i make the source or destination dynamic, it throws an error while mapping ?
I cannot get Linked server permissions and SQL Server Config thing doesn't work as well.
Please suggest on how to load data from one source to multiple server/databases.
Thank you.I just need to transfer one table's data. its like i have to use a query to pick data for
the most recent data. So i use something like, select A, B, C, D from dbo.table where ETL_TIMESTAMP > (the max(etltimestamp) in the destination on different server). There are no foreign key relationships and the data should not be truncated. it just had
to append the new records. -
Components in the lowest level of costing structure in SO
Hi,
Could you please let me know is any function module to get Components in the lowest level of costing structure in Sales order.
Thanks,
HarinathYes, you can manipulate your components any way you like. Becareful about the layout manager though as it likes to handle the positioning and sizing, so there is an intimate relationship there.
Also call validate() on the container after you make your changes. -
TIPS(18) : CREATING SCRIPTS TO RECREATE A TABLE STRUCTURE
제품 : SQL*PLUS
작성날짜 : 1996-11-12
TIPS(18) : Creating Scripts to Recreate a Table Structure
=========================================================
The script creates scripts that can be used to recreate a table structure.
For example, this script can be used when a table has become fragmented or to
get a defintion that can be run on another database.
CREATES SCRIPT TO RECREATE A TABLE-STRUCTURE
INCL. STORAGE, CONSTRAINTS, TRIGGERS ETC.
This script creates scripts to recreate a table structure.
Use the script to reorganise a table that has become fragmented,
to get a definition that can be run on another database/schema or
as a basis for altering the table structure (eg. drop a column!).
IMPORTANT: Running the script is safe as it only creates two new scripts and
does not do anything to your database! To get anything done you have to run the
scripts created.
The created scripts does the following:
1. save the content of the table
2. drop any foreign key constraints referencing the table
3. drop the table
4. creates the table with an Initial storage parameter that
will accomodate the entire content of the table. The Next
parameter is 25% of the initial.
The storage parameters are picked from the following list:
64K, 128K, 256K, 512K, multiples of 1M.
5. create table and column comments
6. fill the table with the original content
7. create all the indexes incl storage parameters as above.
8. add primary, unique key and check constraints.
9. add foreign key constraints for the table and for referencing
tables.
10.Create the table's triggers.
11.Compile any depending objects (cascading).
12.Grant table and column privileges.
13.Create synonyms.
This script must be run as the owner of the table.
If your table contains a LONG-column, use the COPY
command in SQL*Plus to store/restore the data.
USAGE
from SQL*Plus:
start reorgtb
This will create the scripts REORGS1.SQL and REORGS2.SQL
REORGS1.SQL contains code to save the current content of the table.
REORGS2.SQL contains code to rebuild the table structure.
undef tab;
set echo off
column a1 new_val stor
column b1 new_val nxt
select
decode(sign(1024-sum(bytes)/1024),-1,to_char((round(sum(bytes)/(1024*1
024))+1))||'M', /* > 1M new rounded up to nearest Megabyte */
decode(sign(512-sum(bytes)/1024), -1,'1M',
decode(sign(256-sum(bytes)/1024), -1,'512K',
decode(sign(128-sum(bytes)/1024), -1,'256K',
decode(sign(64-sum(bytes)/1024) , -1,'128K',
'64K'
a1,
decode(sign(1024-sum(bytes)/4096),-1,to_char((round(sum(bytes)/(4096*1
024))+1))||'M', /* > 1M new rounded up to nearest Megabyte */
decode(sign(512-sum(bytes)/4096), -1,'1M',
decode(sign(256-sum(bytes)/4096), -1,'512K',
decode(sign(128-sum(bytes)/4096), -1,'256K',
decode(sign(64-sum(bytes)/4096) , -1,'128K',
'64K'
b1
from user_extents
where segment_name=upper('&1');
set pages 0 feed off verify off lines 150
col c1 format a80
spool reorgs1.sql
PROMPT drop table bk_&1
prompt /
PROMPT create table bk_&1 storage (initial &stor) as select * from &1
prompt /
spool off
spool reorgs2.sql
PROMPT spool reorgs2
select 'alter table '||table_name||' drop constraint
'||constraint_name||';'
from user_constraints where r_constraint_name
in (select constraint_name from user_constraints where
table_name=upper('&1')
and constraint_type in ('P','U'));
PROMPT drop table &1
prompt /
prompt create table &1
select decode(column_id,1,'(',',')
||rpad(column_name,40)
||decode(data_type,'DATE' ,'DATE '
,'LONG' ,'LONG '
,'LONG RAW','LONG RAW '
,'RAW' ,'RAW '
,'CHAR' ,'CHAR '
,'VARCHAR' ,'VARCHAR '
,'VARCHAR2','VARCHAR2 '
,'NUMBER' ,'NUMBER '
,'unknown')
||rpad(
decode(data_type,'DATE' ,null
,'LONG' ,null
,'LONG RAW',null
,'RAW' ,decode(data_length,null,null
,'('||data_length||')')
,'CHAR' ,decode(data_length,null,null
,'('||data_length||')')
,'VARCHAR' ,decode(data_length,null,null
,'('||data_length||')')
,'VARCHAR2',decode(data_length,null,null
,'('||data_length||')')
,'NUMBER' ,decode(data_precision,null,' '
,'('||data_precision||
decode(data_scale,null,null
,','||data_scale)||')')
,'unknown'),8,' ')
||decode(nullable,'Y','NULL','NOT NULL') c1
from user_tab_columns
where table_name = upper('&1')
order by column_id
prompt )
select 'pctfree '||t.pct_free c1
,'pctused '||t.pct_used c1
,'initrans '||t.ini_trans c1
,'maxtrans '||t.max_trans c1
,'tablespace '||s.tablespace_name c1
,'storage (initial '||'&stor' c1
,' next '||'&stor' c1
,' minextents '||t.min_extents c1
,' maxextents '||t.max_extents c1
,' pctincrease '||t.pct_increase||')' c1
from user_Segments s, user_tables t
where s.segment_name = upper('&1') and
t.table_name = upper('&1')
and s.segment_type = 'TABLE'
prompt /
select 'comment on table &1 is '''||comments||''';' c1 from
user_tab_comments
where table_name=upper('&1');
select 'comment on column &1..'||column_name||
' is '''||comments||''';' c1 from user_col_comments
where table_name=upper('&1');
prompt insert into &1 select * from bk_&1
prompt /
set serveroutput on
declare
cursor c1 is select index_name,decode(uniqueness,'UNIQUE','UNIQUE')
unq
from user_indexes where
table_name = upper('&1');
indname varchar2(50);
cursor c2 is select
decode(column_position,1,'(',',')||rpad(column_name,40) cl
from user_ind_columns where table_name = upper('&1') and
index_name = indname
order by column_position;
l1 varchar2(100);
l2 varchar2(100);
l3 varchar2(100);
l4 varchar2(100);
l5 varchar2(100);
l6 varchar2(100);
l7 varchar2(100);
l8 varchar2(100);
l9 varchar2(100);
begin
dbms_output.enable(100000);
for c in c1 loop
dbms_output.put_line('create '||c.unq||' index '||c.index_name||' on
&1');
indname := c.index_name;
for q in c2 loop
dbms_output.put_line(q.cl);
end loop;
dbms_output.put_line(')');
select 'pctfree '||i.pct_free ,
'initrans '||i.ini_trans ,
'maxtrans '||i.max_trans ,
'tablespace '||i.tablespace_name ,
'storage (initial '||
decode(sign(1024-sum(e.bytes)/1024),-1,
to_char((round(sum(e.bytes)/(1024*1024))+1))||'M',
decode(sign(512-sum(e.bytes)/1024), -1,'1M',
decode(sign(256-sum(e.bytes)/1024), -1,'512K',
decode(sign(128-sum(e.bytes)/1024), -1,'256K',
decode(sign(64-sum(e.bytes)/1024) , -1,'128K',
'64K'))))) ,
' next '||
decode(sign(1024-sum(e.bytes)/4096),-1,
to_char((round(sum(e.bytes)/(4096*1024))+1))||'M',
decode(sign(512-sum(e.bytes)/4096), -1,'1M',
decode(sign(256-sum(e.bytes)/4096), -1,'512K',
decode(sign(128-sum(e.bytes)/4096), -1,'256K',
decode(sign(64-sum(e.bytes)/4096) , -1,'128K',
'64K'))))) ,
' minextents '||s.min_extents ,
' maxextents '||s.max_extents ,
' pctincrease '||s.pct_increase||')'
into l1,l2,l3,l4,l5,l6,l7,l8,l9
from user_extents e,user_segments s, user_indexes i
where s.segment_name = c.index_name
and s.segment_type = 'INDEX'
and i.index_name = c.index_name
and e.segment_name=s.segment_name
group by s.min_extents,s.max_extents,s.pct_increase,
i.pct_free,i.ini_trans,i.max_trans,i.tablespace_name ;
dbms_output.put_line(l1);
dbms_output.put_line(l2);
dbms_output.put_line(l3);
dbms_output.put_line(l4);
dbms_output.put_line(l5);
dbms_output.put_line(l6);
dbms_output.put_line(l7);
dbms_output.put_line(l8);
dbms_output.put_line(l9);
dbms_output.put_line('/');
end loop;
end;
declare
cursor c1 is
select constraint_name, decode(constraint_type,'U',' UNIQUE',' PRIMARY
KEY') typ,
decode(status,'DISABLED','DISABLE',' ') status from user_constraints
where table_name = upper('&1')
and constraint_type in ('U','P');
cname varchar2(100);
cursor c2 is
select decode(position,1,'(',',')||rpad(column_name,40) coln
from user_cons_columns
where table_name = upper('&1')
and constraint_name = cname
order by position;
begin
for q1 in c1 loop
cname := q1.constraint_name;
dbms_output.put_line('alter table &1');
dbms_output.put_line('add constraint '||cname||q1.typ);
for q2 in c2 loop
dbms_output.put_line(q2.coln);
end loop;
dbms_output.put_line(')' ||q1.status);
dbms_output.put_line('/');
end loop;
end;
declare
cursor c1 is
select c.constraint_name,c.r_constraint_name cname2,
c.table_name table1, r.table_name table2,
decode(c.status,'DISABLED','DISABLE',' ') status,
decode(c.delete_rule,'CASCADE',' on delete cascade ',' ')
delete_rule
from user_constraints c,
user_constraints r
where c.constraint_type='R' and
c.r_constraint_name = r.constraint_name and
c.table_name = upper('&1')
union
select c.constraint_name,c.r_constraint_name cname2,
c.table_name table1, r.table_name table2,
decode(c.status,'DISABLED','DISABLE',' ') status,
decode(c.delete_rule,'CASCADE',' on delete cascade ',' ')
delete_rule
from user_constraints c,
user_constraints r
where c.constraint_type='R' and
c.r_constraint_name = r.constraint_name and
r.table_name = upper('&1');
cname varchar2(50);
cname2 varchar2(50);
cursor c2 is
select decode(position,1,'(',',')||rpad(column_name,40) colname
from user_cons_columns
where constraint_name = cname
order by position;
cursor c3 is
select decode(position,1,'(',',')||rpad(column_name,40) refcol
from user_cons_columns
where constraint_name = cname2
order by position;
begin
dbms_output.enable(100000);
for q1 in c1 loop
cname := q1.constraint_name;
cname2 := q1.cname2;
dbms_output.put_line('alter table '||q1.table1||' add constraint ');
dbms_output.put_line(cname||' foreign key');
for q2 in c2 loop
dbms_output.put_line(q2.colname);
end loop;
dbms_output.put_line(') references '||q1.table2);
for q3 in c3 loop
dbms_output.put_line(q3.refcol);
end loop;
dbms_output.put_line(') '||q1.delete_rule||q1.status);
dbms_output.put_line('/');
end loop;
end;
col c1 format a79 word_wrap
set long 32000
set arraysize 1
select 'create or replace trigger ' c1,
description c1,
'WHEN ('||when_clause||')' c1,
trigger_body ,
'/' c1
from user_triggers
where table_name = upper('&1') and when_clause is not null
select 'create or replace trigger ' c1,
description c1,
trigger_body ,
'/' c1
from user_triggers
where table_name = upper('&1') and when_clause is null
select 'alter trigger '||trigger_name||decode(status,'DISABLED','
DISABLE',' ENABLE')
from user_Triggers where table_name='&1';
set serveroutput on
declare
cursor c1 is
select 'alter table
'||'&1'||decode(substr(constraint_name,1,4),'SYS_',' ',
' add constraint ') a1,
decode(substr(constraint_name,1,4),'SYS_','
',constraint_name)||' check (' a2,
search_condition a3,
') '||decode(status,'DISABLED','DISABLE','') a4,
'/' a5
from user_constraints
where table_name = upper('&1') and
constraint_type='C';
b1 varchar2(100);
b2 varchar2(100);
b3 varchar2(32000);
b4 varchar2(100);
b5 varchar2(100);
fl number;
begin
open c1;
loop
fetch c1 into b1,b2,b3,b4,b5;
exit when c1%NOTFOUND;
select count(*) into fl from user_tab_columns where table_name =
upper('&1') and
upper(column_name)||' IS NOT NULL' = upper(b3);
if fl = 0 then
dbms_output.put_line(b1);
dbms_output.put_line(b2);
dbms_output.put_line(b3);
dbms_output.put_line(b4);
dbms_output.put_line(b5);
end if;
end loop;
end;
create or replace procedure dumzxcvreorg_dep(nam varchar2,typ
varchar2) as
cursor cur is
select type,decode(type,'PACKAGE BODY','PACKAGE',type) type1,
name from user_dependencies
where referenced_name=upper(nam) and referenced_type=upper(typ);
begin
dbms_output.enable(500000);
for c in cur loop
dbms_output.put_line('alter '||c.type1||' '||c.name||' compile;');
dumzxcvreorg_dep(c.name,c.type);
end loop;
end;
exec dumzxcvreorg_dep('&1','TABLE');
drop procedure dumzxcvreorg_Dep;
select 'grant '||privilege||' on '||table_name||' to '||grantee||
decode(grantable,'YES',' with grant option;',';') from
user_tab_privs where table_name = upper('&1');
select 'grant '||privilege||' ('||column_name||') on &1 to
'||grantee||
decode(grantable,'YES',' with grant option;',';')
from user_col_privs where grantor=user and
table_name=upper('&1')
order by grantee, privilege;
select 'create synonym '||synonym_name||' for
'||table_owner||'.'||table_name||';'
from user_synonyms where table_name=upper('&1');
PROMPT REM
PROMPT REM YOU MAY HAVE TO LOG ON AS SYSTEM TO BE
PROMPT REM ABLE TO CREATE ANY OF THE PUBLIC SYNONYMS!
PROMPT REM
select 'create public synonym '||synonym_name||' for
'||table_owner||'.'||table_name||';'
from all_synonyms where owner='PUBLIC' and table_name=upper('&1') and
table_owner=user;
prompt spool off
spool off
set echo on feed on verify on
The scripts REORGS1.SQL and REORGS2.SQL have been
created. Alter these script as necesarry.
To recreate the table-structure, first run REORGS1.SQL.
This script saves the content of your table in a table
called bk_.
If this script runs successfully run REORGS2.SQL.
The result is spooled to REORGTB.LST.
Check this file before dropping the bk_ table.
*/Please do NOT cross-postings: create a deep structure for dynamic internal table
Regards
Uwe
Maybe you are looking for
-
Hello, I have a Mac computer with NVIDIA 750M dedicated graphics card and monitor EIZO but the problem was there when I was working with Windows and Acer monitor. When I open a file from Camera Raw in PS this is smaller than the screen so I double-cl
-
Import process hangs indefinately on JPG and AVI files
Hi, I'm seeing a similar issue to some of the other posts. My configuration is Windows 7 x64, 4GB RAM and a Core i7. All the photos I want imported have been moved to the C drive. When I try to import a folder with a couple of sub-folders containing
-
I am frustrated. iPhoto 8.1.2 with iLife Media Browser 9.04 -- Approx. 2000 vacation photos in library -- picked 400 best and created an album -- When I click slideshow button, the 1st photo fills the screen with the album title superimposed -- I the
-
Media LIbrary's metadata in 2 (or more) languages ?
Hi, I'm using the Media Library, and I set the WD TV's interface in english, to have the Media Lib gather metadata about movies in english, since I watch mostly movies in this language. But I also have some french movies in french, and since my main
-
Bought New Macbook Pro and Lightroom 5 in store -Need to install but don't have a CD/DVD drive
Just got home from purchasing a new Macbook Pro and Lightroom 5. Problem is I do not have a CD/DVD drive. Just opened my Lightroom 5 to install and I'm clueless how to install it on my new laptop UGH! What can I do? Is it possible to install my ne