How to match columns of two tables with
Hello:
I've two tables like below:
Table1:(Base Table)
Country|Prefix|Prefix_Length
CountryA|001|3
CountryB|0012|4
CountryC|00443|5
CountryD|0091|4
Table2:(Detail Table)
Population|Area|Prefix
500|AreaA|0015921
1000|AreaB|00122
400|AreaC|00443743
300|AreaD|0091333
100|AreaA|001
I need to match these two tables with prefix column (which length is not fixed in both tables: but it starts with 00 in both tables). Two different countries prefix can be similar up to a certain length. So, Prefix_Length can be used to determine (exactly) how long should be taken to search from Table2.
Output:
Country|Prefix|Area|Population
CountryA|001|AreaA|600
CountryB|0012|AreaB|1000
CountryC|00443|AreaC|400
CountryD|0091|AreaD|300
Please help me with your valuable feedback.
-Tanvir
You have to explain how CountryA population is calculated:
with base_table as (
select 'CountryA' country,'001' prefix,3 prefix_length from dual union all
select 'CountryB','0012',4 from dual union all
select 'CountryC','00443',5 from dual union all
select 'CountryD','0091',4 from dual
detail_table as (
select 500 population,'AreaA' area,'0015921' prefix from dual union all
select 1000,'AreaB','00122' from dual union all
select 400,'AreaC','00443743' from dual union all
select 300,'AreaD','0091333' from dual union all
select 100,'AreaA','001' from dual
-- end of on-the-fly data sample
select country,
b.prefix,
area,
population
from base_table b,
detail_table d
where b.prefix = substr(d.prefix,1,prefix_length)
COUNTRY PREFI AREA POPULATION
CountryA 001 AreaA 500
CountryA 001 AreaB 1000
CountryA 001 AreaA 100
CountryB 0012 AreaB 1000
CountryC 00443 AreaC 400
CountryD 0091 AreaD 300
6 rows selected.
SQL> SY.
Similar Messages
-
How to Find Two Matching Columns in Two Table(to create a JOIN)
Hi Guys!
I just wondering if it is possible to have a SQL query to find two matches columns in two table to create any type of joins?!
Let's say I have two tables CUSTOMER + INVOICE is it possible to run a SQL query to find two join able columns without scanning the tables visually?!
Best Regards,Well, there's the Data Dictionary you could query for foreign key columns/constraints.
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:661009003696 -
How to encrypt column of some table with the single method on oracle7/814?
How to encrypt column of some table with the single method on oracle7/814?
How to encrypt column of some table with the single method on oracle7/814?
-
How to encrypt column of some table with the single method ?
How to encrypt column of some table with the single method ?
How to encrypt column of some table with the single
method ?How to encrypt column of some table with the single
method ?
using dbms_crypto package
Assumption: TE is a user in oracle 10g
we have a table need encrypt a column, this column SYSDBA can not look at, it's credit card number.
tha table is
SQL> desc TE.temp_sales
Name Null? Type
CUST_CREDIT_ID NOT NULL NUMBER
CARD_TYPE VARCHAR2(10)
CARD_NUMBER NUMBER
EXPIRY_DATE DATE
CUST_ID NUMBER
1. grant execute on dbms_crypto to te;
2. Create a table with a encrypted columns
SQL> CREATE TABLE te.customer_credit_info(
2 cust_credit_id number
3 CONSTRAINT pk_te_cust_cred PRIMARY KEY
4 USING INDEX TABLESPACE indx
5 enable validate,
6 card_type varchar2(10)
7 constraint te_cust_cred_type_chk check ( upper(card_type) in ('DINERS','AMEX','VISA','MC') ),
8 card_number blob,
9 expiry_date date,
10 cust_id number
11 constraint fk_te_cust_credit_to_cust references te.customer(cust_id) deferrable
12 )
13 storage (initial 50k next 50k pctincrease 0 minextents 1 maxextents 50)
14 tablespace userdata_Lm;
Table created.
SQL> CREATE SEQUENCE te.customers_cred_info_id
2 START WITH 1
3 INCREMENT BY 1
4 NOCACHE
5 NOCYCLE;
Sequence created.
Note: Credit card number is blob data type. It will be encrypted.
3. Loading data encrypt the credit card number
truncate table TE.customer_credit_info;
DECLARE
input_string VARCHAR2(16) := '';
raw_input RAW(128) := UTL_RAW.CAST_TO_RAW(CONVERT(input_string,'AL32UTF8','US7ASCII'));
key_string VARCHAR2(8) := 'AsDf!2#4';
raw_key RAW(128) := UTL_RAW.CAST_TO_RAW(CONVERT(key_string,'AL32UTF8','US7ASCII'));
encrypted_raw RAW(2048);
encrypted_string VARCHAR2(2048);
BEGIN
for cred_record in (select upper(CREDIT_CARD) as CREDIT_CARD,
CREDIT_CARD_EXP_DATE,
to_char(CREDIT_CARD_NUMBER) as CREDIT_CARD_NUMBER,
CUST_ID
from TE.temp_sales) loop
dbms_output.put_line('type:' || cred_record.credit_card || 'exp_date:' || cred_record.CREDIT_CARD_EXP_DATE);
dbms_output.put_line('number:' || cred_record.CREDIT_CARD_NUMBER);
input_string := cred_record.CREDIT_CARD_NUMBER;
raw_input := UTL_RAW.CAST_TO_RAW(CONVERT(input_string,'AL32UTF8','US7ASCII'));
dbms_output.put_line('> Input String: ' || CONVERT(UTL_RAW.CAST_TO_VARCHAR2(raw_input),'US7ASCII','AL32UTF8'));
encrypted_raw := dbms_crypto.Encrypt(
src => raw_input,
typ => DBMS_CRYPTO.DES_CBC_PKCS5,
key => raw_key);
encrypted_string := rawtohex(UTL_RAW.CAST_TO_RAW(encrypted_raw)) ;
dbms_output.put_line('> Encrypted hex value : ' || encrypted_string );
insert into TE.customer_credit_info values
(TE.customers_cred_info_id.nextval,
cred_record.credit_card,
encrypted_raw,
cred_record.CREDIT_CARD_EXP_DATE,
cred_record.CUST_ID);
end loop;
commit;
end;
4. Check credit card number script
DECLARE
input_string VARCHAR2(16) := '';
raw_input RAW(128) := UTL_RAW.CAST_TO_RAW(CONVERT(input_string,'AL32UTF8','US7ASCII'));
key_string VARCHAR2(8) := 'AsDf!2#4';
raw_key RAW(128) := UTL_RAW.CAST_TO_RAW(CONVERT(key_string,'AL32UTF8','US7ASCII'));
encrypted_raw RAW(2048);
encrypted_string VARCHAR2(2048);
decrypted_raw RAW(2048);
decrypted_string VARCHAR2(2048);
cursor cursor_cust_cred is select CUST_CREDIT_ID, CARD_TYPE, CARD_NUMBER, EXPIRY_DATE, CUST_ID
from TE.customer_credit_info order by CUST_CREDIT_ID;
v_id customer_credit_info.CUST_CREDIT_ID%type;
v_type customer_credit_info.CARD_TYPE%type;
v_EXPIRY_DATE customer_credit_info.EXPIRY_DATE%type;
v_CUST_ID customer_credit_info.CUST_ID%type;
BEGIN
dbms_output.put_line('ID Type Number Expiry_date cust_id');
dbms_output.put_line('-----------------------------------------------------');
open cursor_cust_cred;
loop
fetch cursor_cust_cred into v_id, v_type, encrypted_raw, v_expiry_date, v_cust_id;
exit when cursor_cust_cred%notfound;
decrypted_raw := dbms_crypto.Decrypt(
src => encrypted_raw,
typ => DBMS_CRYPTO.DES_CBC_PKCS5,
key => raw_key);
decrypted_string := CONVERT(UTL_RAW.CAST_TO_VARCHAR2(decrypted_raw),'US7ASCII','AL32UTF8');
dbms_output.put_line(V_ID ||' ' ||
V_TYPE ||' ' ||
decrypted_string || ' ' ||
v_EXPIRY_DATE || ' ' ||
v_CUST_ID);
end loop;
close cursor_cust_cred;
commit;
end;
/ -
How to give relationship between two tables with comon column with between oprator
Hi Folks,
I am using Sql Server 2008R2. I am getting a problem to establish relationship between two tables.
I have two Tables, 1.Inventory Details Table another one is Inventory Header Table.
Inventory Details Table having a column Card No and inventory Header Table having columns From card No and To Card No.
I want to give relationship between these two tables with Card no. Could you please provide me the Sql Query.
Your help would be greatly appreciated .
Regards
hasthi.
email:[email protected]Hi Raju,
We have two way that we can relate to the table either join or quality condition use following syntax/Query for relating two tables
select * from Inventory_Details ID inner join Inventory_Header IH on ID.CardNo between IH.FrmCardno and IH.ToCardNo
or
Select * from Inventory_Details ID ,Inventory_Header IH where ID.CardNo=IH.CardNo OrSelect * from Inventory_Details ID ,Inventory_Header IH where ID.CardNo between IH.FrmCardno and IH.ToCardNo
Hope this will help you
Niraj Sevalkar -
How to join two columns between two tables with different column names
Hi
How i can join 2 columns with different names between the 2 tables.
Can any one please give solution for this.
Thanks
ManuHi,
basic understanding of joins:
If you want to join 2 tables there should be matching column w.r.t. data and it's data type. You need not to have same column names in both the tables...
so, find those columns which has got same values.. -
Cartesian of data from two tables with no matching columns
Hello,
I was wondering – what’s the best way to create a Cartesian of data from two tables with no matching columns in such a way, so that there will be only a single SQL query generated?
I am thinking about something like:
for $COUNTRY in ns0: COUNTRY ()
for $PROD in ns1:PROD()
return <Results>
<COUNTRY> {fn:data($COUNTRY/COUNTRY_NAME)} </COUNTRY>
<PROD> {fn:data($PROD/PROD_NAME)} </PROD>
</Results>
And the expected result is combination of all COUNTRY_NAMEs with all PROD_NAMEs.
What I’ve noticed when checking query plan is that DSP will execute two queries to have the results – one for COUNTRY_NAME and another one for PROD_NAME. Which in general results in not the best performance ;-)
What I’ve noticed also is that when I add something like:
where COUNTRY_NAME != PROD_NAME
everything is ok and there is only one query created (it's red in the Query plan, but still it's ok from my pov). Still it looks to me more like a workaround, not a real best approach. I may be wrong though...
So the question is – what’s the suggested approach for such queries?
Thanks,
Leszek
Edited by xnts at 11/19/2007 10:54 AMWhich in general results in not the best performanceI disagree. Only for two tables with very few rows, would a single sql statement give better performance.
Suppose there are 10,000 rows in each table - the cross-product will result in 100 million rows. Sounds like a bad idea. For this reason, DSP will not push a cross-product to a database. It will get the rows from each table in separate sql statements (retrieving only 20,000 rows) and then produce the cross-product itself.
If you want to execute sql with cross-products, you can create a sql-statement based dataservice. I recommend against doing so. -
How to update two columns in two tables?
hi friends
I have two tables linked to each other through SaleNo and SaleDT. their structure as below
Sales Table============
SaleNo int PK auto increment
SaleDT Datetime PK
Qnty decimal
Units decimal
Invoices table
=================InvoiceNo int PK Auto incremented
InvoiceDT Datetime
SaleNo int FK
SaleDT Datetime FK
Note that SaleDT column is NOT assigned with getDate() expression.
1. what I need to do is update the SaleDT column of Sales table and Invoices table with the value '2013-01-31 10:31:55.813', how do I do this without manually breaking the link between the tables?
2. Assume SaleNos 15 to 27 needs update the SaleDT to '2013-06-12 10:31:55.813', how do I do this complex operation where I I have update SaleDt column of two table of SaleNo range from 15 to 27?
thanks
I use Visual studio 2012 Ultimate and SQL server 2008 developer edition!Why not below? May be you will not be able to change your design now, but just want to share.
Sales Table============
SALEID int PK autoincrement
SaleNo int
SaleDT Datetime
Qnty decimal
Units decimalUNIQUE (Saleno,SaleDT)
Invoices table
=================InvoiceNo int PK Auto incremented
InvoiceDT Datetime
SALEID int FK -
How to compare two rows from two table with different data
how to compare two rows from two table with different data
e.g.
Table 1
ID DESC
1 aaa
2 bbb
3 ccc
Table 2
ID DESC
1 aaa
2 xxx
3 ccc
Result
2Create
table tab1(ID
int ,DE char(10))
Create
table tab2(ID
int ,DE char(10))
Insert
into tab1 Values
(1,'aaa')
Insert
into tab1 Values
(2,'bbb')
Insert
into tab1 Values(3,'ccc')
Insert
into tab1 Values(4,'dfe')
Insert
into tab2 Values
(1,'aaa')
Insert
into tab2 Values
(2,'xx')
Insert
into tab2 Values(3,'ccc')
Insert
into tab2 Values(6,'wdr')
SELECT
tab1.ID,tab2.ID
As T2 from tab1
FULL
join tab2 on tab1.ID
= tab2.ID
WHERE
BINARY_CHECKSUM(tab1.ID,tab1.DE)
<> BINARY_CHECKSUM(tab2.ID,tab2.DE)
OR tab1.ID
IS NULL
OR
tab2.ID IS
NULL
ID column considered as a primary Key
Apart from different record,Above query populate missing record in both tables.
Result Set
ID ID
2 2
4 NULL
NULL 6
ganeshk -
How to insert data into two tables linke with foreign key..
I have two tables
1)EMP(emp_ID,username,emp_type_code)
emp_ID is primary key, emp_type_code is a foreign key references emptype table.
2)emptype(emp_type_code,emp_type_descripton)
emp_type_code is primary key
Could anyone help me ..how to insert data into EMP table. How to insert data into two tables linke with foreign key..CREATE TABLE "CATDB"."DWDIMUSER"
"USER_ID" NUMBER(10,0) NOT NULL ENABLE,
"SPECIALTY_ID" NUMBER(10,0),
"FULLNAME" VARCHAR2(20 BYTE),
"FNAME" VARCHAR2(20 BYTE),
"LNAME" VARCHAR2(20 BYTE),
"USER_SUBTYPE" VARCHAR2(20 BYTE),
CONSTRAINT "DIMUSER_PK" PRIMARY KEY ("USER_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE,
CONSTRAINT "DIMUSER_DIMSPECIALTY_FK" FOREIGN KEY ("SPECIALTY_ID") REFERENCES "CATDB"."DWDIMSPECIALTY" ("SPECIALTY_ID") DISABLE
CREATE TABLE "CATDB"."DIMSPECIALTY"
"SPECIALTY_ID" NUMBER(10,0) NOT NULL ENABLE,
"SPECIALTY_NAME" VARCHAR2(100 BYTE),
CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("SPECIALTY_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
INSERT INTO DIMUSER (FullName, FNAME, LNAME, USER_TYPE, USER_SUBTYPE)
SELECT DISTINCT
Engineer AS FullName,
regexp_substr(Engineer , '[^,| ]+', 1, 1) as FName,
regexp_substr(Engineer , '[^,| ]+', 1, 2) as LName ,
'Engineer'
FROM EMPLOYEELOOKUP;
INSERT INTO DIMSPECIALTY (SPECIALTY_NAME)
SELECT DISTINCT SPECIALITY
FROM EMPLOYEELOOKUP;
COMMIT;
CREATE TABLE employeelookup ...IS A TABLE THAT HAS ALL THE DATA NEDED TO BE FILLED IN BOTHE TABLES...
CREATE TABLE "CATDB"."EMPLOYEELOOKUP"
"EMPLOYEELOOKUP_ID" NUMBER(10,0) NOT NULL ENABLE,
"ENGINEER" VARCHAR2(25 BYTE),
"SPECIALTY" VARCHAR2(20 BYTE),
CONSTRAINT "DIMSPECIALTY_PK" PRIMARY KEY ("EMPLOYEELOOKUP_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "CATDB" ENABLE
DATA IN EMPLOYEELOOKUP
Engineer, Specialty,
John, Dow, Electronis,
Dow, Jons, Technician
Stan Smithers Sales
Mark, Richards Marketing
Jenny, Lane Marketing
John, Lee Sales
I NEED TO LOAD THE FOREIGN KEY IN DIMUSER FROM THE DIMSPECIALTY TABLE?
BY USING THE LOOKUP TABLE TO MARCH THE NAMES UNDER THE Engineer COLUMN, SPECIALTY COLUMNE DISTICTIVLY BY JOINING THE DIMSPECILTY TO RISTIVE THE PRIMARY KEY AND FILL IT IN THE DIMUSER TABLE AS A FOREIGNE KEY. -
Hi my name is vishal
For past 10 days i have been breaking my head on how to make column headers in table appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp.
Given below is my code in c# on how i export datas from different tables in sql server to PDF report using iTextSharp:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.Diagnostics;
using System.IO;
namespace DRRS_CSharp
public partial class frmPDF : Form
public frmPDF()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
Document doc = new Document(PageSize.A4.Rotate());
var writer = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
doc.SetMargins(50, 50, 50, 50);
doc.SetPageSize(new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.LETTER.Width, iTextSharp.text.PageSize.LETTER.Height));
doc.Open();
PdfPTable table = new PdfPTable(6);
table.TotalWidth =530f;
table.LockedWidth = true;
PdfPCell cell = new PdfPCell(new Phrase("Institute/Hospital:AIIMS,NEW DELHI", FontFactory.GetFont("Arial", 14, iTextSharp.text.Font.BOLD, BaseColor.BLACK)));
cell.Colspan = 6;
cell.HorizontalAlignment = 0;
table.AddCell(cell);
Paragraph para=new Paragraph("DCS Clinical Record-Assigned Dialyzer",FontFactory.GetFont("Arial",16,iTextSharp.text.Font.BOLD,BaseColor.BLACK));
para.Alignment = Element.ALIGN_CENTER;
iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo5.png");
png.ScaleToFit(105f, 105f);
png.Alignment = Element.ALIGN_RIGHT;
SqlConnection conn = new SqlConnection("Data Source=NPD-4\\SQLEXPRESS;Initial Catalog=DRRS;Integrated Security=true");
SqlCommand cmd = new SqlCommand("Select d.dialyserID,r.errorCode,r.dialysis_date,pn.patient_first_name,pn.patient_last_name,d.manufacturer,d.dialyzer_size,r.start_date,r.end_date,d.packed_volume,r.bundle_vol,r.disinfectant,t.Technician_first_name,t.Technician_last_name from dialyser d,patient_name pn,reprocessor r,Techniciandetail t where pn.patient_id=d.patient_id and r.dialyzer_id=d.dialyserID and t.technician_id=r.technician_id and d.deleted_status=0 and d.closed_status=0 and pn.status=1 and r.errorCode<106 and r.reprocessor_id in (Select max(reprocessor_id) from reprocessor where dialyzer_id=d.dialyserID) order by pn.patient_first_name,pn.patient_last_name", conn);
conn.Open();
SqlDataReader dr;
dr = cmd.ExecuteReader();
table.AddCell("Reprocessing Date");
table.AddCell("Patient Name");
table.AddCell("Dialyzer(Manufacturer,Size)");
table.AddCell("No.of Reuse");
table.AddCell("Verification");
table.AddCell("DialyzerID");
while (dr.Read())
table.AddCell(dr[2].ToString());
table.AddCell(dr[3].ToString() +"_"+ dr[4].ToString());
table.AddCell(dr[5].ToString() + "-" + dr[6].ToString());
table.AddCell("@count".ToString());
table.AddCell(dr[12].ToString() + "-" + dr[13].ToString());
table.AddCell(dr[0].ToString());
dr.Close();
table.SpacingBefore = 15f;
doc.Add(para);
doc.Add(png);
doc.Add(table);
doc.Close();
System.Diagnostics.Process.Start("AssignedDialyzer.pdf");
if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.Yes)
var writer2 = PdfWriter.GetInstance(doc, new FileStream("AssignedDialyzer.pdf", FileMode.Create));
else if (MessageBox.Show("Do you want to save changes to AssignedDialyzer.pdf before closing?", "DRRS", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation) == DialogResult.No)
this.Close();
The above code executes well with no problem at all!
As you can see the file to which i create and save and open my pdf report is
AssignedDialyzer.pdf.
The column headers of table in pdf report from c# windows forms using iTextSharp are
"Reprocessing Date","Patient Name","Dialyzer(Manufacturer,Size)","No.of Reuse","Verification" and
"DialyzerID".
However the problem i am facing is after execution and opening of document is my
column headers in table in pdf report from
c# and datas in it all appear in bold.
I have browsed through net regarding to solve this problem but with no success.
What i want is my pdf report from c# should be similar to following format which i was able to accomplish in vb6,adodb with MS access using iTextSharp.:
Given below is report which i have achieved from vb6,adodb with MS access using iTextSharp
I know that there has to be another way to solve my problem.I have browsed many articles in net regarding exporting sql datas to above format but with no success!
Is there is any another way to solve to my problem on exporting sql datas from c# windows forms using iTextSharp to above format given in the picture/image above?!
If so Then Can anyone tell me what modifications must i do in my c# code given above so that my pdf report from c# windows forms using iTextSharp will look similar to image/picture(pdf report) which i was able to accomplish from
vb6,adodb with ms access using iTextSharp?
I have approached Sound Forge.Net for help but with no success.
I hope anyone/someone truly understands what i am trying to ask!
I know i have to do lot of modifications in my c# code to achieve this level of perfection but i dont know how to do it.
Can anyone help me please! Any help/guidance in solving this problem would be greatly appreciated.
I hope i get a reply in terms of solving this problem.
vishalHi,
About iTextSharp component issue , I think this case is off-topic in here.
I suggest you consulting to compenent provider.
http://sourceforge.net/projects/itextsharp/
Regards,
Marvin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
11GR2
=-----------------------------------
I am using below querry to compare two table that has same name, under two different users... But after making storage information false like below and if the storage information is different on column level than it create "Alter modify " statements for the column ... How can I make my query to compare only columns of two tables... not the storage information?
begin
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'PRETTY', TRUE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'SEGMENT_ATTRIBUTES', FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'STORAGE', FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'TABLESPACE',FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'CONSTRAINTS',FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'REF_CONSTRAINTS',FALSE);
DBMS_METADATA.SET_TRANSFORM_PARAM(DBMS_METADATA.SESSION_TRANSFORM,'CONSTRAINTS_AS_ALTER',FALSE);
End;
select REGEXP_REPLACE(dbms_metadata_diff.compare_alter('TABLE','TABLE_NAME_A','TABLE_NAME_A','USER1','USER2'),('USER1...'),'', 1, 0, 'i') from dualI am using below querry to compare two table that has same name, under two different users... But after making storage information false like below and if the storage information is different on column level than it create "Alter modify " statements for the column ... How can I make my query to compare only columns of two tables... not the storage information?
If you want help you have to SHOW us what you are doing and how you are doing it; you can't just try to tell us in your own words.
We can't see your computer screen. -
How to update two tables with trigger
Hi:
how to update two tables with trigger ?
I have two tables :
(1)ASIA
MI number;
(2)ASIA_P
ID number;
When I insert a new value into the asia.MI ,I also can
insert the same value into the asia_p.id field.
I have write a trigger as follows but it does't work.
create or replace trigger MI_TRG
before insert on asia
for each row
declare
seq number;
begin
select MI_SEQ.Nextval into seq from dual;
:new.MI:=seq;
insert into ASIA_PRO(MI_ID)
values
(seq);
end MI_TRG;
How to realize it ?
thanks
zzmWhy do you say it does not work?
-
To find matching records across two tables
Hi folks,
I have a question regarding modifying the query. I am trying to compare the data between two tables, there are matching records in two tables, but are not in the same order. How to modify the query so that it finds the matching record between the two tables?
Here is my code
loop at itab_A.
read table itab_B with key
employeenumber = itab_zmgr_training-empid binary search.
if sy-subrc = 0.
Any thoughts?
Thanks,
Sk
Here I am getting the return value as '4'I have tried all that, but why is it that while reading a record from itab_B I see no record in the header line,
Let me paste the entire code of what I am trying to achieve.
data: itab_A like A occurs 0 with header line.
data: itab_B like B occurs 0 with header line.
some validation.....
loop at itab_A.
read table itab_B with key employee number = empid binary search.
if sy-subrc =0.
per form validation.
else.
perform validation.
endif.
endloop.
My observation: while reading recrod from itab_B the header line is clear, no record is read here hence sy-subrc = 0.
How can I correct this? Since it is not reading any record from itab_B no matching record is found.
Any thoughts would be really helpful.
Thanks,
Santhosh. -
How can I load data into table with SQL*LOADER
how can I load data into table with SQL*LOADER
when column data length more than 255 bytes?
when column exceed 255 ,data can not be insert into table by SQL*LOADER
CREATE TABLE A (
A VARCHAR2 ( 10 ) ,
B VARCHAR2 ( 10 ) ,
C VARCHAR2 ( 10 ) ,
E VARCHAR2 ( 2000 ) );
control file:
load data
append into table A
fields terminated by X'09'
(A , B , C , E )
SQL*LOADER command:
sqlldr test/test control=A_ctl.txt data=A.xls log=b.log
datafile:
column E is more than 255bytes
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)
1 1 1 1234567------(more than 255bytes)Check this out.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96652/ch06.htm#1006961
Maybe you are looking for
-
In Advanced Search Web Part , more than 5 properties filter cannot be added
In SharePoint 2013 Advanced Search Web Part, Under Add Property restrictions, Maximum number of search filter (AND / OR) is allowed is 5. How can I increase this count ?
-
Iphone 6 screengate/popgate issue. (Philippines)
So i noticed that my iphone has a screengate/popgate issue after 3 months of having it, will apple replace my phone? or will they repair it? My phone has never been dropped or placed on my pocket. I'm in the Philippines btw.
-
SInce uploading ios7 on my ipad 2 using verizon fios service my response time surfing the web acts as if I am using a modem. Any ideas how i can fix this??
-
IMP: WF Events related to Vendor and Invoices
Hi Guys, I'm looking for following 4 wf events related to Vendor and Invoices: 1. When new Vendors are Created, 2. When Vendors are Updated, 3. When Vendor Invoices are Created, 4. When Vendor Invoices are Updated, I could find 'oracle.apps.po.event.
-
Performance issues; waited too long for a row cache enqueue lock!
hi Experts, OS: Oracle Solaris on SPARC (64-bit) DB version: SQL> select * from V$VERSION; BANNER Oracle Database 11g Release 11.2.0.1.0 - 64bit Production PL/SQL Release 11.2.0.1.0 - Production CORE 11.2.0.1.0 Production TNS for Solaris: Ver