Tables Structure
Hello,
There are different website sections names. Each section have some preferences and each preferences hae some options:
create sequence WebsiteSections_seq
start with 1 increment by 1;
create or replace trigger WebsiteSections_trig
before insert
on WebsiteSections
for each row
begin
:new.section_id := WebsiteSections_seq.nextval;
end;
create table Preferences(
prefer_id number(14) primary key,
section_id number(14) constraint Preferences_fk references WebsiteSections(section_id),
preference varchar2(230)
create sequence Preferences_seq
start with 1 increment by 1;
create or replace trigger Preferences_trig
before insert
on Preferences
for each row
begin
:new.prefer_id := Preferences_seq.nextval;
end;
create table SubPreferences(
sprefer_id number(14) primary key,
prefer_id number(14) constraint SubPreferences_fk references Preferences(prefer_id),
sPreference varchar2(230)
create sequence SubPreferences_seq
start with 1 increment by 1;
create or replace trigger SubPreferences_trig
before insert
on SubPreferences
for each row
begin
:new.sprefer_id := SubPreferences_seq.nextval;
end;
/ Now I want to reuse this data to stor user preferences for different tables e.g. profile as follow:
create table ProfilePreferences(
pref_id number(14) primary key,
profile_id number(14) constraint ProfilePreferences_fk1 references Profile(profile_id),
prefer_id number(14) constraint ProfilePreferences_fk2 references Preferences(prefer_id)
create sequence ProfilePreferences_seq
start with 1 increment by 1;
create or replace trigger ProfilePreferences_trig
before insert
on ProfilePreferences
for each row
begin
:new.pref_id := ProfilePreferences_seq.nextval;
end;
create table PreferredOptions(
po_id number(14) primary key,
pref_id number(14) constraint PreferredOptions_fk references ProfilePreferences(pref_id),
sprefer_id number(14) constraint PreferredOptions_fk1 references SubPreferences(sprefer_id)
create sequence PreferredOptions_seq
start with 1 increment by 1;
create or replace trigger PreferredOptions_trig
before insert
on PreferredOptions
for each row
begin
:new.po_id := PreferredOptions_seq.nextval;
end;
/ Will I created these tables again to store preferences for e.g. news
Please advise will the above structure is okay and standard?
Best regards
thanks for your reply
Christy H. wrote:
Will I created these tables again to store preferences for e.g. newsSorry, I don't understand what you mean here.
There are different sections of website and each section has its preferences e.g. profile section of website have following example preferences:
a) Send intimation to my contacts when our profile is updated //Preference table data
b) Don’t send me reminders to complete company profile //Preference table data
c) Don’t send me email alerts about my selected interests //Preference table data
d) Show my profile to: //Preference table data
-------------------------i. Everyone (default) //Sub Preference table data
-------------------------ii. My 1st degree contacts //Sub Preference table data
-------------------------iii. My network //Sub Preference table data
e) Send me email when any company from my contacts update its company profile //Preference table data
Please advise will the above structure is okay and standard?It looks ggod, but there's only so much I can say out of context.
Your question is a little like asking "Do these seem like good directions: Go south 200 meters on Elm Street, trun left onto Broadway, continue for 1,200 meters, the turn left onto route 28, ..." Without knowing where you're starting from, or where you want to go, or even whether you're walking or going by car, all anyone could say is the most obvious things (like "you seem to be going in a loop").
I apologize for any inconvenience but confess I am stupid and can not explain my questions well. I am bit confused in drawing the preference and sub preference as well as to connect them to profile table that's why I posted here sort help. This is what I tried to copy from master to detail tables for each profile but not sure its correct or not?
create table ProfilePreferences(
pref_id number(14) primary key,
profile_id number(14) constraint ProfilePreferences_fk1 references Profile(profile_id),
prefer_id number(14) constraint ProfilePreferences_fk2 references Preferences(prefer_id)
create sequence ProfilePreferences_seq
start with 1 increment by 1;
create or replace trigger ProfilePreferences_trig
before insert
on ProfilePreferences
for each row
begin
:new.pref_id := ProfilePreferences_seq.nextval;
end;
create table PreferredOptions(
po_id number(14) primary key,
pref_id number(14) constraint PreferredOptions_fk references ProfilePreferences(pref_id),
sprefer_id number(14) constraint PreferredOptions_fk1 references SubPreferences(sprefer_id)
create sequence PreferredOptions_seq
start with 1 increment by 1;
create or replace trigger PreferredOptions_trig
before insert
on PreferredOptions
for each row
begin
:new.po_id := PreferredOptions_seq.nextval;
end;
I don't see any obvious mistakes in what you posted. (You didn't post CREATE TABLE statements for WebstiteSections or Profile.)
create table Profile(
profile_id number(14) primary key,
user_id number(14) constraint Profile_fk1 references Users(user_id),
region_id number(14) constraint Profile_fk2 references Regions(region_id),
country_id number(14) constraint Profile_fk3 references Countries(country_id),
city_id number(14) constraint Profile_fk4 references Cities(city_id),
ps_id number(14) constraint Profile_fk5 references ProfileStatus(ps_id),
agree_id number(14) constraint Profile_fk6 references Agreement(agree_id),
cat_id number(14) constraint Profile_fk7 references Categories(cat_id),
pDate timestamp(0) default sysdate,
physicalAddress varchar2(360),
website varchar2(50),
haveBranches number(2)
create table WebsiteSections(
section_id number(14) primary key,
section varchar2(50)
Do Preferrences and SubPreferences need to be separate tables, or would it be better to combine them into one table, perhaps with a column to indiciate if each row is a (Super-) Preference or a Sub-Preference?Please check my new posted tables and advise
thanks again for favored reply
Similar Messages
-
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. -
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 -
Vendor-Customer balances in group currency-table/structure/function module?
Hi All,
Which table/structure/function module can be used to get balances for vendors and customers in group currency? We just wnat to extract balances in group currency so FBL1N and FBL5N are not options. Is there any SAP report which can provide these balances for both vendors and customers?
Thanks and regards,
PinkyHi Pinky,
I came across one report S_ALR_87012079 - Transaction Figures: Account Balance, Program RFSRRCUA, which extracts Account Balances of Vendor. Once the report is executed, you can do Currency Translation from one currency to different currencies. In the output screen, in the Top Menu, select 'Settings -> Currency' and you can convert to another currency. I am not sure, if this helps you. If this helps, kindly update your comments here.
Thank you.
Suresh Jayanthi. -
In our current implementation we have a Blank page with Text Field [field format Rich Text] on generated PDF Document.
Once the PDF document is generated, user can copy paste content form any word/rtf document to into the Text Field.
Pasted content retains all text formatting [Bold, Italic, Underline, Indentation] except the Table format. Text Field is removing table metadata from the content and converting it into plant text.
Is there anyway to copy paste table structure as it is from word document into Text Field?Hi,
I don't think you can! While you can paste formatted text into the rich text field, the table metadata means nothing to the textfield.
Niall -
Insert multiple text files to multiple tables that have different table structures
Hi All,
I have a small problem. I have lots of text files in a folder location. Say for an example Company.txt, Code.txt. I need to insert all these files to tables similar to the file structure. Company file to Company table and Code file to Code table. The catch
is that all these table structures differ one to another.
How can i do this using SSIS? I guess using a for each loop with some data flow task would be a start.
Can some body give me a step by step example on how i can achieve this.
Thanks
LMIt is very complicated to accomplish the above requirement using the standard Data Flow Task. You have to essentially setup a separate task for each table layout. If you can use third-party solutions, check the commercial CozyRoc
Data Flow Task Plus. It is an extension of the standard Data Flow Task, with ability to do dynamic data flows at runtime. You can load all your tables and layouts with only one Data Flow Task. The other benefit is the solution doesn't require programming.SSIS Tasks Components Scripts Services | http://www.cozyroc.com/ -
Table structure and constraints in HTML table
This script creates a html file (Structure.html) that contains structure of a specific table.
When the following script is executed in sql * plus, it asks for the table name for which
structure information is needed. after entering the table name, it writes the table structure
into structure.html file.
SET LINESIZE 150
SET PAGESIZE 150
SET FEEDBACK OFF
SET VERIFY OFF
COLUMN "COLUMN NAME" FORMAT A50
COLUMN "DATA TYPE" FORMAT A15
COLUMN "IS NULL" FORMAT A15
COLUMN CONSTRAINTS FORMAT A15
PROMPT Enter table name:
ACCEPT TABNAME
SET MARK HTML ON
SPOOL STRUCTURE.html
PROMPT &TABNAME
-- Query ---
SELECT TRIM(A.COLUMN_NAME) AS "COLUMN NAME",
TRIM(DATA_TYPE||'('||DECODE(A.DATA_LENGTH,22,A.DATA_PRECISION||','||A.DATA_SCALE,
A.DATA_LENGTH) || ')') AS "DATA TYPE",
TRIM(DECODE(A.NULLABLE,'Y',' ','NOT NULL')) AS "IS NULL",
TRIM(DECODE(C.CONSTRAINT_TYPE,'P','PRIMARY KEY','R','FOREIGN KEY('||D.TABLE_NAME||')','U','UNIQUE', 'C','CHECK')) AS CONSTRAINTS,
TRIM(C.CONSTRAINT_NAME) AS "CONSTRAINT NAME",
C.SEARCH_CONDITION AS "CHECK CONDITION",
A.DATA_DEFAULT AS "DEFAULT VALUE"
FROM USER_TAB_COLS A,
USER_CONS_COLUMNS B,
USER_CONSTRAINTS C,
USER_CONS_COLUMNS D
WHERE
A.TABLE_NAME = '&TABNAME' AND
A.TABLE_NAME = B.TABLE_NAME(+) AND
A.COLUMN_NAME = B.COLUMN_NAME(+) AND
B.CONSTRAINT_NAME = C.CONSTRAINT_NAME(+) AND
C.R_CONSTRAINT_NAME = D.CONSTRAINT_NAME(+);
SPOOL OFF
SET MARK HTML OFFHi,
For Head Count you can use 0HR_PA_0 datasource and the other Employee details like start date and end date you can get them from employee master data and FTE can be calculated from the Emloyee Master Data and Head count data.
Hope this helps...
Thanks, -
Flex 3: Update SQLite Table Structure?
I don't have any issues with creating my table when it doesn't exist but I have a quesion about updating the table structure. For instance I want to add two new fields if they don't exist.
Does anyone have an example of updating table structure? Process flow would have to first check for table, if it doesn't exits then create it. If it does exist then check it has all the correct fields. If it doesn't then update table structure.
Is there a built in way to do this with SQLite?
Here is my current code...
private function getRecords():void
var sqlQuery:String = "CREATE TABLE IF NOT EXISTS Roster (" +
"selected TEXT DEFAULT 'false' NOT NULL,"+
"name TEXT NOT NULL," +
"time TEXT NOT NULL," +
"gender TEXT NOT NULL" +
dbStatement = new SQLStatement();
dbStatement.itemClass = Roster;
dbStatement.sqlConnection = exampleDB;
dbStatement.text = sqlQuery;
dbStatement.addEventListener(SQLEvent.RESULT, onDBStatementSelectResult);
dbStatement.execute();
sqlQuery= "select * from Roster";
dbStatement.text = sqlQuery;
dbStatement.addEventListener(SQLEvent.RESULT, onDBStatementSelectResult);
dbStatement.execute();
I want to add in two new fields is possible without asking user to delete the table first.
"wins TEXT DEFAULT '0' NOT NULL," +
"loses TEXT DEFAULT '0' NOT NULL" +
Thanks in advance.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 -
How to read a table/structure value in a container from a Z program
Experts,
I have a WF with one of the container element is a multiline table element of the strucuture BSEG. Now I have a report where given a WID, i need to read the contents of this structure from the workflow container and display in ALV grid.
I'm using the FM SAP_WAPI_READ_CONTAINER or SWW_WI_CONTAINER_READ to read the container. No issues till here now.
I'm able to read the contents of the attributes that are simple without being in a structure/table.
But, how do i read the values from the table/structure in the container from this FM?
I see lots of threads talking about SWC_GET_TABLE or something like that. But I don't know whether and how to use it in my scenario. Any sample programs will be greatly appreciated.
Thanks,
SamHey,
No issues. I sorted out myself. Glory to God in the Heavens!
-Sam -
Table Structure of Oracle Application
Hi,
Where i can have a look to oracle table structure on net. pls. write the address.
Thanks in adv.Sujata,
if you are talking about oracle apps, try following link
http://etrm.oracle.com/pls/etrmlatest/etrm_search.search
and for database table structure, try
otn.oracle.com
Yogi
[email protected] -
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 -
How to generate sql script based on table structure
I want to generate a sql script based on a table structure.
For example:
if the table is:
cid id c_value
1 1 zz
2 1 yy
3 2 zz
4 2 xx
5 3 ss
6 3 tt
The expected output is:
WITH
CHILD_tab as (
SELECT 1 cid, 1 id,'zz' c_value from dual union all
SELECT 2 cid, 1 id,'yy' c_value from dual union all
SELECT 3 cid, 2 id,'zz' c_value from dual union all
SELECT 4 cid, 2 id,'xx' c_value from dual union all
SELECT 5 cid, 3 id,'ss' c_value from dual union all
SELECT 6 cid, 3 id,'tt' c_value from dual )
Release 11.1.0.7.0I'm doing a lot of XML these days (too much perhaps) so here's a solution involving XQuery.
We pass a query string and it outputs a CLOB containing the WITH clause :
SELECT DBMS_XMLGEN.Convert(
XMLQuery(
q'[concat(
"WITH t AS (
string-join(
for $i in /ROWSET/ROW
return concat( " SELECT ",
string-join($i/*/concat("'",ora:replace(text(),"'","''"),"' ",local-name()),", "),
" FROM dual" ),
" UNION ALL
passing dbms_xmlgen.getXMLType('SELECT * FROM scott.emp')
returning content
).getClobVal(), 1) AS WITH_CLAUSE
FROM dual;
WITH_CLAUSE
WITH t AS (
SELECT '7369' EMPNO, 'SMITH' ENAME, 'CLERK' JOB, '7902' MGR, '17/12/80' HIREDATE, '800' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7499' EMPNO, 'ALLEN' ENAME, 'SALESMAN' JOB, '7698' MGR, '20/02/81' HIREDATE, '1600' SAL, '300' COMM, '30' DEPTNO FROM dual UNION ALL
SELECT '7521' EMPNO, 'WARD' ENAME, 'SALESMAN' JOB, '7698' MGR, '22/02/81' HIREDATE, '1250' SAL, '500' COMM, '30' DEPTNO FROM dual UNION ALL
SELECT '7566' EMPNO, 'JONES' ENAME, 'MANAGER' JOB, '7839' MGR, '02/04/81' HIREDATE, '2975' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7654' EMPNO, 'MARTIN' ENAME, 'SALESMAN' JOB, '7698' MGR, '28/09/81' HIREDATE, '1250' SAL, '1400' COMM, '30' DEPTNO FROM dual UNION ALL
SELECT '7698' EMPNO, 'BLAKE' ENAME, 'MANAGER' JOB, '7839' MGR, '01/05/81' HIREDATE, '2850' SAL, '30' DEPTNO FROM dual UNION ALL
SELECT '7782' EMPNO, 'CLARK' ENAME, 'MANAGER' JOB, '7839' MGR, '09/06/81' HIREDATE, '2450' SAL, '10' DEPTNO FROM dual UNION ALL
SELECT '7788' EMPNO, 'SCOTT' ENAME, 'ANALYST' JOB, '7566' MGR, '19/04/87' HIREDATE, '3000' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7839' EMPNO, 'KING' ENAME, 'PRESIDENT' JOB, '17/11/81' HIREDATE, '5000' SAL, '10' DEPTNO FROM dual UNION ALL
SELECT '7844' EMPNO, 'TURNER' ENAME, 'SALESMAN' JOB, '7698' MGR, '08/09/81' HIREDATE, '1500' SAL, '0' COMM, '30' DEPTNO FROM dual UNION ALL
SELECT '7876' EMPNO, 'ADAMS' ENAME, 'CLERK' JOB, '7788' MGR, '23/05/87' HIREDATE, '1100' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7900' EMPNO, 'JAMES' ENAME, 'CLERK' JOB, '7698' MGR, '03/12/81' HIREDATE, '950' SAL, '30' DEPTNO FROM dual UNION ALL
SELECT '7902' EMPNO, 'FORD' ENAME, 'ANALYST' JOB, '7566' MGR, '03/12/81' HIREDATE, '3000' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7934' EMPNO, 'MILLER' ENAME, 'CLERK' JOB, '7782' MGR, '23/01/82' HIREDATE, '1300' SAL, '10' DEPTNO FROM dual
)It may be useful for small data sets only because we quickly hit ORA-01706. -
Demantra PTP table structure changed in 7.3.X.X
The staging tables structure is changed in Demantra version 7.3 onwards as compared to Demantra 7.2.X.X. Some of the "Required" columns in "BIIO_Promotion" table which is used to load promotion data`has been removed in Demantra 7.3. And some more "Required" columns are added in "BIIO_Promotion" table.
The disappointing thing is that the implementation and user guide doesn't speak about it. How the implementer know, what type of values to load in these mandatory columns to populate the promotion data in Demantra.
Regards,
Milind...go to tables statements -
> double click on the structure----> it will takes you to that structure -
How to check PSA Table Structure ?
Hi Friends,
Can you pls any one tell me how to find out PSA Table and how to check PSA Table Structure? .Thanks in advance.
Regards,
CSHi Sri,
Goto RSA1 trans> select your DS> right clcik> Manage> you will get a Pop-up with all the PSA requests--> on the top Left you can see the PSA name(Technical name) in the form PSA/BIC/BXXXXXX
PSA & DS structue will be same. Goto RSO2 transaction> Enter your DS name> double click on the extract structure. It will take you to the Extract structure.
(Or) if you know the extract structure name, directly goto Se11 trans & enter the technical name of Extract structure & Display.
Take the screenshot & send it to your TL.
Regards,
Pavan -
HR tables structure for BW data extraction
Hi Experts,
How the HR tables structure are different from other SAP tables in BW data extraction perspective.
Appreciate your help in this regard.
Thanks,
Varun.The 1st and great difference is the time dependency of HR 'Infotype' and so when you load master data, it is in great part time dependent!
Message was edited by: Claudio Caforio
Maybe you are looking for
-
How do I remove a song from an itunes album on my MacBook without removing it from my library or from another album. It ended up in the wrong album
-
Fixed graphic mode causes windows freezing dv7
Hello guys, I have a question about my hp dv7-6b21sm which has i7 2670qm, 8gb of ddr3, 1tb of hdd and a hd6770m graphic card. Now to the problem. A little ago I've figured that battlefield 3 will not run in fullscreen unless I turn on "Fixed" graphic
-
What is better for music editing mac mini or macbook air?
Which mac would you prefer for music editing a mac mini with 2,6gHz quad-core i7 CPU, 16 GB RAM and SSD 256GB or a macbook air 13" with 1,7 dual-core i7, 8GB ram and 256GB SSD? Both will be connected to a 27" screen so portability doesn't matter.
-
Wont print black with new cartidge
i have an all in one b111 series hp photosmart 5510 printer it will not print black at all. what can i do to fix it. i have tried all the trouble shooting tips on the site and also the things on the printer like cleaning the print head.
-
Where is my final cut pro x package?
So I bought and got to download the fcpx. Will the package not arrive by mail as well - in a nice bright shiny box? What am I missing here?