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;
/

Similar Messages

  • 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 tables on oracle734/oracle817 ?

    How to encrypt column of some tables on oracle734/oracle817 ?

    Unless you are very good writing C ... upgrade to a version of the product supported during the current millennium.

  • Need some help with the String method

    Hello,
    I have been running a program for months now that I wrote that splits strings and evaluates the resulting split. I have a field only object (OrderDetail) that the values in the resulting array of strings from the split holds.Today, I was getting an array out of bounds exception on a split. I have not changed the code and from I can tell the structure of the message has not changed. The string is comma delimited. When I count the commas there are 26, which is expected, however, the split is not coming up with the same number.
    Here is the code I used and the counter I created to count the commas:
    public OrderDetail stringParse(String ord)
    OrderDetail returnOD = new OrderDetail();
    int commas = 0;
      for( int i=0; i < ord.length(); i++ )
        if(ord.charAt(i) == ',')
            commas++;
      String[] ordSplit = ord.split(",");
      System.out.println("delims: " + ordSplit.length + "  commas: " + commas + "  "+ ordSplit[0] + "  " + ordSplit[1] + "  " + ordSplit[2] + "  " + ordSplit[5]);
    The rest of the method just assigns values to fields OrderDetail returnOD.
    Here is the offending string (XXX's replace characters to hide private info)
    1096200000000242505,1079300000007578558,,,2013.10.01T23:58:49.515,,USD/JPY,Maker,XXX.XX,XXX.XXXXX,XXXXXXXXXXXXXXXX,USD,Sell,FillOrKill,400000.00,Request,,,97.7190000,,,,,1096200000000242505,,,
    For this particular string, ordSplit.length = 24 and commas = 26.
    Any help is appreciated. Thank you.

    Today, I was getting an array out of bounds exception on a split
    I don't see how that could happen with the 'split' method since it creates its own array.
    For this particular string, ordSplit.length = 24 and commas = 26.
    PERFECT! That is exactly what it should be!
    Look closely at the end of the sample string you posted and you will see that it has trailing empty strings at the end: '1096200000000242505,,,'
    Then if you read the Javadocs for the 'split' method you will find that those will NOT be included in the resulting array:
    http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#split(java.lang.String)
    split
    public String[] split(String regex)
    Splits this string around matches of the given regular expression.  This method works as if by invoking the two-argument split method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array.
    Just a hunch but your 'out of bounds exception' is likely due to your code assuming that there will be 26 entries in the array and there are really only 24.

  • 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.

  • How do I create a target table with the same PK as the source table?

    I am trying to create a target table in a mapping that will end up with the same primary key as the source table.
    It is a simple map that simply uses a subset of the columns of the source table in the target table. I was wanting to create and bind a new table by dragging the columns I want from the source to the initially blank target table operator, change the column names and create a primary key to match the source table.
    I can't seem to be able to create a constraint on the table in the mapping. I can create the constraint after the table is created and boound to the database object but the PK doesn't carry back into the mapping.
    I need it in the mapping so I can use the UPDATE/INSERT operation and use the 'All Constraints' implementation. The mapping won't let me validate the object without the PK on it in the map.
    Believe it or not folks, I am getting better at this.
    Thanks very much for the guidance.
    Gary

    Hi Gary
    You are close, you are really close... :-))
    You need to do exactly as you propose plus one extra step. Build the map as you describe, binding the new table to the target. Then you edit the table definition to add the primary key and any other constraints you need. After this is the step that you are missing.
    You need to do the following:
    1. Go back and re-edit the map
    2. Right click on the table
    3. From the pop up menu, select Reconcile Inbound
    4. Set any operators that you need for the UPDATE/INSERT
    5. Save the map
    6. Commit your changes
    The first three steps above make the map read in the indexes and constraints that you set on the table. Finally, you need to deploy the table and then deploy the map.
    Hope this helps
    Regards
    Michael

  • How to create an dynamic internal table with the structure of a ddic table

    Hi all,
    I want to fill ddic-tables (which I already created) in my abap dictionary with data out of CSV-files (which are located on the CRM-Server).  The ddic tables have different amount of fields.
    I started with creating a table which contains the name of the tables and the path to the matching CSV-file.
    At the beginning I'm filling an internal table with part of this data (the name of the ddic-tables) - after that I am looping at this internal table.
    LOOP AT lt_struc ASSIGNING <lfs_struc>.
         LOOP AT lv_itab1 INTO lv_wa1 WHERE ztab_name = <lfs_struc>.
         lv_feld = lv_wa1-zdat_name.
        ENDLOOP.
        CONCATENATE 'C:\-tmp\Exportierte Tabellen\' lv_feld INTO lv_pfad.
        Do.
        OPEN DATASET lv_pfad FOR INPUT IN TEXT MODE ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
        READ DATASET lv_pfad INTO lv_rec.
        IF sy-subrc NE 0.
          EXIT.
        ENDIF.
        enddo.
        REPLACE ALL OCCURRENCES OF '"' IN lv_rec WITH ''.
        SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
        INSERT into (<lfs_struc>) values lr_str_value.
        CLOSE DATASET lv_pfad.
    endloop.
    This is not the whole code, but it's working until
    SPLIT lv_rec AT ';' INTO TABLE lt_str_values.
    I want to split all the data of lv_rec into an internal table which has the structure of the current ddic-table, but I didn't find out how to do give the internal table the structure of the ddic-table. In the code I used an internal tyble type string but I should be the structure of the matching tabel.
    If I try to create an internal table by using a fiel symbol, I am told, that the data types are not matching.
    Has anyone an idea?

    Hi Mayari,
    though you were successfull with
    METHOD cl_alv_table_create=>create_dynamic_table
    I must warn you not to use it. The reason is that the number of tables created is limited, the method uses GENERATE SUBROUTINE statement and this triggers an unwanted database commit.
    If you know the DDIC structure, it is (starting with ECC6.0) much easier:
    field-symbols:
      <table> type standard table.
    data:
      lr_data type ref to data.
    Create data lr_data type table of (<DDIC structure>).
    assign lr_data->* to <table>.
    The split code can be simplified gaining speed loosing complexity not loosing functionality.
    field-symbols:<fs_s> type any.
    field-symbols:<fs_t> type any.
    SPLIT lv_rec AT ';' INTO table it_string.
    loop at it_string assigning <fs_s>.
      assign component sy-tabix of wa_string to <fs_t>.
    if sy-subrc = 0.
      <fs_t> = <fs_s>.
    endif.
    at last.
      append <fs_itwa3> to <ft_itab3>.
    endat.
    endloop.
    Though it may work as Keshav.T suggested, there is no need to do that way.     
    Regards,
    Clemens

  • How to rename column name of table?

    Hello...
    How to rename column name of table?
    The column have data.
    Thanks.
    Martonio.

    The following should work in 9i release 2 and above.
    SQL> create table mytable(col1 varchar2(2),
      2  col2 date);
    Table created.
    SQL> insert into mytable values('t1',sysdate);
    1 row created.
    SQL> select * from mytable;
    CO COL2
    t1 30-NOV-04
    1 row selected.
    SQL> desc mytable
    Name                                      Null?    Type
    COL1                                               VARCHAR2(2)
    COL2                                               DATE
    SQL> alter table mytable rename column col2 to mydate;
    Table altered.
    SQL> desc mytable
    Name                                      Null?    Type
    COL1                                               VARCHAR2(2)
    MYDATE                                             DATE
    SQL> select * from mytable;
    CO MYDATE
    t1 30-NOV-04
    1 row selected.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.3.0 - Productionhttp://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/wnsql.htm#972698

  • How to make column headers in table in PDF report appear bold while datas in table appear regular from c# windows forms with sql server2008 using iTextSharp

    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.
    vishal

    Hi,
    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.

  • Need some help with the Table Function Operator

    I'm on OWB 10gR2 for Sun/Solaris 10 going against some 10gR2 DB's...
    I've been searching up and down trying to figure out how to make OWB use a Table Function (TF) which will JOIN with another table; allowing a column of the joined table to be a parameter in to the TF. I can't seem to get it to work. I'm able to get this to work in regular SQL, though. Here's the setup:
    -- Source Table:
    DROP TABLE "ZZZ_ROOM_MASTER_EX";
    CREATE TABLE "ZZZ_ROOM_MASTER_EX"
    ( "ID" NUMBER(8,0),
    "ROOM_NUMBER" VARCHAR2(200),
    "FEATURES" VARCHAR2(4000)
    -- Example Data:
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (1,'Room 1',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (2,'Room 2',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (3,'Room 3','1,1;2,3;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (4,'Room 4','5,2;5,4;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (5,'Room 5',' ');
    -- Destination Table:
    DROP TABLE "ZZZ_ROOM_FEATURES_EX";
    CREATE TABLE "ZZZ_ROOM_FEATURES_EX"
    ( "ROOM_NUMBER" VARCHAR2(200),
    "FEATUREID" NUMBER(8,0),
    "QUANTITY" NUMBER(8,0)
    -- Types for output table:
    CREATE OR REPLACE TYPE FK_Row_EX AS OBJECT
    ID NUMBER(8,0),
    QUANTITY NUMBER(8,0)
    CREATE OR REPLACE TYPE FK_Table_EX AS TABLE OF FK_Row_EX;
    -- Package Dec:
    CREATE OR REPLACE
    PACKAGE ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX;
    END ZZZ_SANDBOX_EX;
    -- Package Body:
    CREATE OR REPLACE
    PACKAGE BODY ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX
    AS
    RETURN_VALUE FK_Table_EX := FK_Table_EX();
    i NUMBER(8,0) := 0;
    BEGIN
    -- TODO: Put some real code in here that will actually read the
    -- input string, parse it out, and put data in to RETURN_VALUE
    WHILE(i < 3) LOOP
    RETURN_VALUE.EXTEND;
    RETURN_VALUE(RETURN_VALUE.LAST) := FK_Row_EX(4, 5);
    i := i + 1;
    END LOOP;
    RETURN RETURN_VALUE;
    END UNFK;
    END ZZZ_SANDBOX_EX;
    I've got a source system built by lazy DBA's and app developers who decided to store foreign keys for many-to-many relationships as delimited structures in driving tables. I need to build a generic table function to parse this data and return it as an actual table. In my example code, I don't actually have the parsing part written yet (I need to see how many different formats the source system uses first) so I just threw in some stub code to generate a few rows of 4's and 5's to return.
    I can get the data from my source table to my destination table using the following SQL statement:
    -- from source table joined with table function
    INSERT INTO ZZZ_ROOM_FEATURES_EX(
    ROOM_NUMBER,
    FEATUREID,
    QUANTITY)
    SELECT
    ZZZ_ROOM_MASTER_EX.ROOM_NUMBER,
    UNFK.ID,
    UNFK.QUANTITY
    FROM
    ZZZ_ROOM_MASTER_EX,
    TABLE(ZZZ_SANDBOX_EX.UNFK(ZZZ_ROOM_MASTER_EX.FEATURES)) UNFK
    Now, the big question is--how do I do this from OWB? I've tried several different variations of my function and settings in OWB to see if I can build a single SELECT statement which joins a regular table with a table function--but none of them seem to work, I end up getting SQL generated that won't compile because it doesn't see the source table right:
    INSERT
    /*+ APPEND PARALLEL("ZZZ_ROOM_FEATURES_EX") */
    INTO
    "ZZZ_ROOM_FEATURES_EX"
    ("ROOM_NUMBER",
    "FEATUREID",
    "QUANTITY")
    (SELECT
    "ZZZ_ROOM_MASTER_EX"."ROOM_NUMBER" "ROOM_NUMBER",
    "INGRP2"."ID" "ID_1",
    "INGRP2"."QUANTITY" "QUANTITY"
    FROM
    (SELECT
    "UNFK"."ID" "ID",
    "UNFK"."QUANTITY" "QUANTITY"
    FROM
    TABLE ( "ZZZ_SANDBOX_EX"."UNFK2" ("ZZZ_ROOM_MASTER_EX"."FEATURES")) "UNFK") "INGRP2",
    "ZZZ_ROOM_MASTER_EX" "ZZZ_ROOM_MASTER_EX"
    As you can see, it's trying to create a sub-query in the FROM clause--causing it to just ask for "ZZZ_ROOM_MASTER_EX"."FEATURES" as an input--which isn't available because it's outside of the sub-query!
    Is this some kind of bug with the code generator or am I doing something seriously wrong here? Any help will be greatly appreciated!

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • 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

  • How can i define a boolean variable with the condition if i got a specific text on a selected column?

    How can i define a boolean variable with the condition if i got a specific text on a selected column?
    Example:
    my select results:
    [id = 102] [Company = 'Microsoft']
    If i got microsoft in 'Company' i want to my another table with the columnName "Microsoft" get "true".
    Can you help me?

    That is called 2-table UPDATE.
    Example:
    http://www.sqlusa.com/bestpractices2005/updatewithcorrelatedsubquery/
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Repeat header's column in a table with row height that greater then 200px

    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    I develop a website and encounter some problem about web page printing. I try to repeat header's column in a table with row's height that greater than or equal to 198px, but it doesn't work. Another size that lower than 198px works fine. If somebody has seen this issue before and know a solution, please help me. Thanks in advance.
    == This happened
    ==
    Every time Firefox opened
    == Firefox version
    ==
    3.6.6
    == Operating system
    ==
    Windows XP
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
    == Plugins installed
    ==
    *-6.0.12.1739
    *RealPlayer(tm) LiveConnect-Enabled Plug-In
    *PDF-XChange Viewer Netscape Gecko Plugin
    *Default Plug-in
    *Shockwave Flash 8.0 r22
    *Adobe Shockwave for Director Netscape plug-in, version 11.0
    *3.0.40624.0
    *Office Live Update v1.3
    *Windows Presentation Foundation (WPF) plug-in for Mozilla browsers
    *Next Generation Java Plug-in 1.6.0_18 for Mozilla browsers
    *Npdsplay dll
    *DRM Store Netscape Plugin
    *DRM Netscape Network Object

    Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
    [http://forums.mozillazine.org/viewforum.php?f=25]
    You'll need to register and login to be able to post in that forum.

  • General Scenario- Adding columns into a table with more than 100 million rows

    I was asked/given a scenario, what issues do you encounter when you try to add new columns to a table with more than 200 million rows? How do you overcome those?
    Thanks in advance.
    svk

    For such a large table, it is better to add the new column to the end of the table to avoid any performance impact, as RSingh suggested.
    Also avoid to use any default on the newly created statement, or SQL Server will have to fill up 200 million fields with this default value. If you need one, add an empty column and update the column by using small batches (otherwise you lock up the whole
    table). Add the default after all the rows have a value for the new column.

  • How can i creat CRC 32 CHECK WITH THE lookup table as attached.

    how can i creat CRC 32 CHECK WITH THE lookup table.attached
    i creat one,but not match the result number C++ version
    result number C++ version:
    FE 00 18 02 40 1E 65 43 00 03 E8        CRC32=>78 1F E9 06
    FE 01 18 02 40 1E 65 43 00 03 E8        CRC32=>F8 8F 49 61
    FE 02 18 02 40 1E 65 43 00 03 E8        CRC32=>7D FF B4 7F

    due to some reason i can not attach the table.but you can find it herehttp://lavag.org/topic/15325-crc32/,it in the CRC.llb 84.03K =>CRC-32 Table.ctl thanks a lot

Maybe you are looking for

  • Opening a web page in the same window ...

    Hi all, I wanted to open a web page in the same content area(window) and not in an external window . Could you tell me how its done ... Regards, Jayant.

  • Failed to Deploy orchestration

    Experts, I am importing an MSI on server and getting following error. same MSI I imported on my local machine and imported successfully without any issues. Thanks in adv. 2Venture2

  • PO - Acct Assignment

    Hi All, We use the account assignment category  M and while creating PO from a Sales order. It used to hit a Balance sheet G/L account but for some reason/change it is hitting a P/L consumption account. Can anyone let me know how i can check in the s

  • DSL too slow for Mt Lion download

    I've been trying to download Mt. Lion from the App store for 2 days now.  I am only at about 800mb.  I continually pause and resume. to get it to continue dlownloading  It tells me I'm at ~8-9 hours.  But then it gets hung up.  This is the computer w

  • Updating anything in CS5

    I just installed CS5 to my new laptop (which has Windows 8) and I can't get anything to update. I've tried it manually and via the "help" tab in Photoshop and Bridge. I get an error message every time. What I really need is Camera Raw to be updated,