How to use the slider in the insertion of data in table to another

Hi all

I am beginner in oracle and I have a question to deal with my table

I have 2 table lets say (c1) and (c2).

C1 contains the following columns (product_number, product_name, description)

C2 contains the following columns (product_code, product_id, description)

I need to build anonymous blocks including cursor, this extraction of cursor data c2 to insert in c1 in the following way:

product_code = product_number,

product_id = product_name,

description = description

a help can you please...?

Thanks for all,

Best regards.

Sorry to say that this is not "talking nonsense." the statement below, you wrote, updated the TABLE whenever a row is inserted:

Update products

Set service_code = 'VOIP', Charge_type = 'FIXED', PRODUCT_TYPE = 'SERVICE', super_product = 'n',

available = 'Y', default_bill_method = 'TIPS', default_prorate = 'Y', gl_code = '00000',.

service_type = "COMPLEMENTARY", partner_code is "oman", used_service_code = "VOIP."

I can't believe that's what you intend to update an entire table every time that a row is inserted.

The second problem I see is that you try to use v_x and you aren't anything to assign to this variable.  Whence 'rownum '?  ROWNUM is generated when choosing and assigned to the rows in a result set.  Looking at a rewrite of your code that actually works now:

SQL > declare
2
3 v_sku TMP_TABLE. Type % SKU;
v_DESCRIPTION 4 tmp_table. DESCRIPTION of % type;
5 v_MSRP TMP_TABLE. Type of MSRP %;
6 v_BILLING_FREQUENCY TMP_TABLE. Type of BILLING_FREQUENCY %;
7 v_ALLOW_PRICE_CHANGE TMP_TABLE. Type of ALLOW_PRICE_CHANGE %;
8 v_status TMP_TABLE. % OF STATUS TYPE.
v_x 9 varchar2 (20);
10
11 tmp_product of CURSOR IS
12. SELECT "p" | status of prod_id, SKU, LTrim (to_char(rowNum,'0999999')), ALLOW_PRICE_CHANGE, BILLING_FREQUENCY, advised, DESCRIPTION retail price
13 FROM tmp_table
14 where sku is not null;
15
BEGIN 16
17
18 open tmp_product;
19
loop 20
21
22 extract tmp_product in v_x, v_SKU, v_status, v_DESCRIPTION, v_MSRP, v_BILLING_FREQUENCY, v_ALLOW_PRICE_CHANGE;
23 when the output tmp_product % notfound;
24
25 INSERT INTO PRODUCTS (product_code, product_name, description, available, DEFAULT_BILL_FREQ, APPLY_SPECIAL_RATES)
26 values (v_x, v_SKU, v_DESCRIPTION, v_status, v_BILLING_FREQUENCY, v_ALLOW_PRICE_CHANGE);
27
28 END LOOP;
29 close tmp_product;
30
31 products update
32 set service_code = 'VOIP', Charge_type = 'FIXED', PRODUCT_TYPE = 'SERVICE', super_product = 'n',
33 available = 'Y', default_bill_method = 'TIPS', default_prorate = 'Y', gl_code = '00000',.
34 service_type = 'SUPPLEMENTARY', partner_code = 'oman', used_service_code is "VOIP."
35
36 commit;
END 37;
38.

PL/SQL procedure successfully completed.

SQL >
SQL > select *.
2 from products
3 where rownum<>

PRODUCT_CODE PRODUCT_NAME DESCRIPTION AVAILABLE SERVER PRODUCT_TYPE CHARGE_T DEFAULT_BILL S DEFAULT_BILL D GL_CO PARTNER_ USED_SER APP SERVICE_TYPE
-------------------- ---------------------------------------- -------------------------------------------------------------------------------- ------------ ------------ -------- -------- ------------ - ------------ - ----- -------------------- -------- -------- ---
p0000095 Plerkle213 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
p0000096 Plerkle214 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
p0000097 Plerkle215 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
p0000098 Plerkle216 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
p0000099 Plerkle217 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
p0000100 Plerkle218 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
p0000101 Plerkle219 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
p0000102 Plerkle220 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
p0000103 Plerkle221 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
p0000104 Plerkle222 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES

10 selected lines.

The update has been moved out of the loop, the useless '<>null' condition has been changed to "is not null" and v_x is generated by the cursor query itself.

David Fitzjarrell

Tags: Database

Similar Questions

  • kindly tell how to use the unique value of a table with the index 0

    kindly tell how to use the unique value of a table with the index 0

    Hi
     
    Yep, use Index Array as Gerd says. Also, using the context help ( + h) and looking through the array palette will help you get an understanding of what each VI does.
     
    This is fundamental LabVIEW stuff, perhaps you'd be better spending some time going through the basics.
     
    -CC
  • HOW to use the file/BLOB data temporary - email for multiple users... Please see code

    Dear gurus
    the code below works fine, he sends a good fixation to the first user, but to the 2nd user, it send blank (empty) file.
    What I want, I have read the data from the source and enter the temporary BLOB and use the same data to send several users in the loop.


    create or replace
    PROCEDURE dba_ho.emailattacheulhr is
    / * LOB related operation varriables * /.
    v_src_loc BFILE.
    l_buffer RAW (54);
    l_amount directory: = 54;
    l_pos INTEGER: = 1;
    l_blob BLOB: = EMPTY_BLOB;
    l_blob_len INTEGER.
    v_amount INTEGER.
    / * Related UTL_SMTP varriavles. */
    v_connection_handle UTL_SMTP. CONNECTION;
    v_from_email_address VARCHAR2 (200);
    v_to_email_address VARCHAR2 (200);
    v_cc VARCHAR2 (200);
    v_smtp_host VARCHAR2 (50);
    v_subject VARCHAR2 (500);
    l_message VARCHAR2 (30000);
    l_filename VARCHAR2 (4000);
    CustNo number (8);
    CNAME varchar2 (50);

    cst slider is
    Select a.EMAIL_ADDR, a.CARDHOLDER_NAME
    Cust a
    ORDER BY a.cust_no;

    / * This procedure of send_header is mentioned in the documentation * /.
    PROCEDURE send_header (pi_name IN VARCHAR2, pi_header IN VARCHAR2) AS
    BEGIN
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    pi_name | ': ' || pi_header | UTL_TCP. CRLF);
    END;

    BEGIN
    v_src_loc: = BFILENAME ('DIR_MMAIL', 'MAKPROM.pdf');
    v_from_email_address: = '[email protected] ';
    v_cc: = '[email protected] ';
    v_smtp_host: = 'mailhost.mak.com ';
    v_subject: = 'list of Promotion of Mak;
    -l_blob BLOB: = EMPTY_BLOB;
    / * Prepare the LOB of attachment file. */
    DBMS_LOB. OPEN (v_src_loc, DBMS_LOB. LOB_READONLY); -Read the file
    DBMS_LOB. CREATETEMPORARY (l_blob, TRUE); -Create a temporary LOB to store the file.
    v_amount: = DBMS_LOB. GETLENGTH (v_src_loc); -Amount to be stored.
    DBMS_LOB. LOADFROMFILE (l_blob, v_src_loc, v_amount); -A temporary file in LOB loading
    l_blob_len: = DBMS_LOB.getlength (l_blob);


    Begin
    CSE opened;

    loop
    extract the CSE in custno, v_to_email_address, cname;
    When the output cst % notfound;

    l_message: = 'Dear customer ' | UTL_TCP. CRLF;
    l_message: = l_message | CNAME | UTL_TCP. CRLF;
    l_message: = l_message | UTL_TCP. CRLF;
    l_message: = l_message | "Thanks for choosing. Enclosed please find our current list of promotion for your review. '||
    UTL_TCP. CRLF;
    l_message: = l_message | UTL_TCP. CRLF;
    l_message: = l_message | "Sincere friendships. UTL_TCP. CRLF;
    l_message: = l_message | UTL_TCP. CRLF;
    l_message: = l_message | UTL_TCP. CRLF;
    l_message: = l_message | "To Mak' | UTL_TCP. CRLF;
    l_message: = l_message | ' www.mak.com' | UTL_TCP. CRLF;

    / * Associated with coding UTL_SMTP. */
    v_connection_handle: = UTL_SMTP. OPEN_CONNECTION (v_smtp_host, 25);
    UTL_SMTP. HELO (v_connection_handle, v_smtp_host);
    UTL_SMTP. MAIL (v_connection_handle, v_from_email_address);
    UTL_SMTP. RCPT (v_connection_handle, v_to_email_address);
    UTL_SMTP. RCPT (v_connection_handle, v_cc);

    UTL_SMTP. OPEN_DATA (v_connection_handle);
    send_header ("", v_from_email_address) ;--|| ("<>'");
    send_header ("TO", v_to_email_address) ;--|| ("<>'");
    send_header ('CC', v_cc);
    send_header ('Subject', v_subject);

    -MIME header.
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    "MIME-Version: 1.0 ' |" UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    ' Content-Type: multipart/mixed; ' || UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    "boundary =" ' | "'" Sample.SECBOUND' | '"' ||
    UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);

    -Body of the message
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    '--' || "Sample.SECBOUND" | UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    ' Content-Type: text/plain; "|| UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    'charset = US-ASCII' | UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle, l_message |) UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);

    -Attachment of e-mail
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    '--' || "Sample.SECBOUND" | UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    ' Content-Type: application/octet-stream' |
    UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    ' Content-Disposition: attachment; ' || UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    "filename =" ' | "MakMail.pdf" | '"' || UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    ' Content-Transfer-Encoding: base64' | UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);
    / * Write the BLOB into pieces * /.
    While l_pos < l_blob_len LOOP
    DBMS_LOB. READ (l_blob, l_amount, l_pos, l_buffer);
    UTL_SMTP.write_raw_data (v_connection_handle,
    UTL_ENCODE. Base64_encode (l_buffer));
    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);
    l_buffer: = NULL;
    l_pos: = l_pos + l_amount;
    END LOOP;
    UTL_SMTP. WRITE_DATA (v_connection_handle, UTL_TCP. CRLF);

    -E-mail nearby
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    '--' || "Sample.SECBOUND" | '--' || UTL_TCP. CRLF);
    UTL_SMTP. WRITE_DATA (v_connection_handle,
    UTL_TCP. CRLF. '.' || UTL_TCP. CRLF);
    UTL_SMTP. CLOSE_DATA (v_connection_handle);
    UTL_SMTP. Quit (v_connection_handle);
    -DBMS_LOB. FREETEMPORARY (l_blob);
    -DBMS_LOB. FileClose (v_src_loc);

    End loop;


    EXCEPTION
    WHILE OTHERS THEN
    UTL_SMTP. Quit (v_connection_handle);
    DBMS_LOB. FREETEMPORARY (l_blob);
    DBMS_LOB. FILECLOSE (V_SRC_LOC);
    dbms_output.put_line (SQLERRM); -try to print the error message.
    END;
    DBMS_LOB. FREETEMPORARY (l_blob);
    DBMS_LOB. FileClose (v_src_loc);
    End;

    -end of code

    Help, please.

    Concerning

    S.Garewal

    This is what happens when you copy a code without understanding.
    Take a look at the code here

    /* Writing the BLOB in chunks */
    WHILE l_pos < l_blob_len LOOP
    DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
    UTL_SMTP.write_raw_data(v_connection_handle,
    UTL_ENCODE.BASE64_ENCODE(l_buffer));
    UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
    l_buffer := NULL;
    l_pos := l_pos + l_amount;
    END LOOP;
    

    Discover the parameters of DBMS_LOB. READ.
    For the first time it's good reading but your position and the quantity is not initialized when you loop and read again and is not read correctly.

  • How to use the aggregate with Date function

    Hi all

    I have a Group date is it possible of Max and Min to date.

    I tried like this but its out errored <? MIN (current - group () / CREATION_DATE)? >.

    I also tried this, but it does not work
    <? xdoxslt:minimum (CREATION_DATE)? >

    Is it possible to use the function of aggregation with date values.

    Thanks and greetings
    Srikkanth

    You can use
    Ensure that the "date" is in canonical format

  • How to add the new model feature with tables of another data schema?

    Hi all

    I am trying to add an entity data model to my request. The tables I need are on a schema that does NOT have a default schema of connection of the connection. So I go through the Wizard add new Entity Data Model, generation from database, but then when it comes time to choose your database objects, the only thing that shows is all that is on the default schema. How can I access stuff to another schema with an entity data model?

    (Tangentially: it is also a problem with the old Server Explorer simply itself - when adding an oracle db, I see the other schema object in the treeview control to break.) But when I right click the db and the new query, tables of other scheme become available to me here. "So it is less of a problem in the case of Server Explorer).

    I found this small excerpt to reach other patterns, but I couldn't make it work in the case of the ora db. Any suggestions?

    Thanks for the tips,
    -sff

    Suppose that schema_a has granted privileges to schema_b on database belonged to schema_a objects by running the GRANT statements.
    You add a connection in Server Explorer using schema_b, and then add the schema_a in the "Filters" menu... ». Don't forget to click on
    the button of update in "Filters" dialog box and confirm schema_a illustrated with schema_b in the column 'value '.

    When to use EDM Wizard to create a database data model, choose the connection that you added by using Server Explorer
    schema_b. You will see the database of objects belonging to both schema_b and schema_a select and generate your data model. Schema_b
    should be able to use the database objects belonged to schema_a according to the privileges granted.

  • Flex 3: how to use the trace print data in the console

    Hello

    I heard that we can use trace to print data on the console in Flex Builder 3. But when I try, it's of no luck.

    Below is a simple program, in which I was out of luck.


    public function callMe (): void
    {
    trace ("AAA");

    }

    < mx:Button id = 'Save' name = 'Save' label = "Save" height = "23" click = "callMe ()" / >

    Here in the porogram above, after you have clicked on the button, I can't see 'AAA' related inside my Flex Builder.

    Any help?

    Thank you.

    Hi Kiran

    Made a breakpoint to the line of trace and debug the application you can find the message u typed in the console... trace works only in debug mode... not in development mode...

    Good day

    Thank you

    RAM

  • How to use the Group feature in insert or update

    Hai All

    How to use the Group feature in insert or update statement

    I'm generating attendance so I have a different set of timing example

    0800,1200,1230, 1700 and I need to insert data into the table that contains the intimate value min and max value for

    outtime and othere to inertval time in or out

    Pls tell me with some examples


    For example

    For INSERT

    Insert into T2 (barcode, empcode, respondent, attend_date)
    values (R2.cardn, R2.enpno, min(R2.) PtIMe), R2.pdate);


    Update

    Update dail_att set outtime = MAX (r2.ptime) where empcode = r2.enpno and barcode = r2.cardn and
    attend_date = r2.pdate;


    Here, in the place where I used to have so pls tell how to use

    Thanks and greetings

    Srikkanth.M

    Hi Srikkanth.M

    to insert:

    insert into test (dummy) values ((select max (dummy) to double));

    Update:

    Update test dummy value = (select max (dummy) to double where to test them. XXXXField = double. XXXXField);

  • Satellite M300 - how to use the recovery disk

    Hello world

    I was wondering how to use the 2 recovery discs that I burned recently if I wanted to fix my USB ports (as seen in my Toshiba M300 - wire to USB ports)

    Any suggestions?

    Hello

    You can use the only recovery disk to reinstall the whole OS!
    This means that the use of the recovery disk will format the whole HARD drive and will set the laptop back to factory settings!

    If you want to use the recovery disk and then insert it into the ODD and the start-up of this disc.
    Then the installation of the OS should move forward and you should follow the instructions on the screen.

    All that s

  • Satellite U300 - how to use the recovery disk?

    I inserted the recovery disc 1 and then restarted my computer, but nothing happened.
    I really need to fix my cause cell it's time to review!

    Does anyone know how to use the recovery disk or affecting function press when the laptop starts to use the programmed recovery?

    Thank you!

    Hello!

    If you have inserted the recovery disc you must only start her everything that s!

    I m not sure but I think you can go into the advanced boot menu if you press F12. Alternative change you the boot priority in the BIOS. You can access BIOS by pressing F2.

    Good bye

  • How to use the global variable in the table target?

    Hello

    I am trying to load several files into a single interface. the data is loaded successfully. 92. the files are there. for this I used variables and package.

    My requrement is 92 files of data loaded into the target table. I want to know what data from file.

    to this I added a column (filename) to the existing target table.

    If I used joints (not same condition), its totally wrong. all file names are coming.

    Please see the following screenshots.

    err27.jpg

    exit; target table.

    err26.jpg

    in fact in the target table. first 10 lines are coming from file.i.e first _ACCOUNT_LIMIT_511.TXT. but all the files names are coming.

    I'm confuse. After the first data file inserted then insert second data file. in that all file names are coming. Please help me.

    I thought that the global variable is preferable to identify the data came from which file.

    to do this, the global variable is used in the target table. I don't always have my exit.

    Please help me.

    Thanks in advance.

    err25.jpg

    Hello

    You can use the same way, how you use the project variable, just you have to do a thin is #GLOBAL.variable_name for example: #GLOBAL. SMART_AL_FILE_NAME_S

    Note: Make sure you that while you use one variable overall in interface, indicator should be staged as you chose above the screen

    hope this helps you

    Kind regards

    Phanikanth

  • How to use the same point of view as read only in the ADF and editable

    Hello

    How to use the same point of view as read only in the ADF and editable? How can we succeed in TF?

    -James

    Hello

    Steven Davelaar wrote a presentation on this 'building highly reusable Taskflows.

    From slide 14, that's where your use case comes into play

    Frank

  • With no headphone jack, how to use the iPhone in my car 7

    Okay, so here's the challenge.  I have a power source and a headphone and not Bluetooth.  It works perfectly with iPhones before 7.  But with 7, it isn't possible to use the same configuration I had for years.  I own my car, and I have no interest in buying a new car just to support a new phone.  And since this will be a problem for the years to come if I stay with Apple, I would like to know what are the solutions are available.

    So, how to use the new iPhone 7 while remaining responsible and using my car speakers?  Dongles Bluetooth that I need to reload, it's probably not.

    Thus, looking for ideas that might have people.  I can't be the only one with this concern.

    It's almost a certainty that a third party adapter will appear quickly. The new Macbook has a single port usb - c and people asked the same question, 'how to load and use USB at the same time." There are today dozens of solutions for the Macbook, and then it will be with the iPhone 7. An adapter with a 3.5 mm jack and a port of loading Lightening would be my guess. Kickstarter entrepreneurs are probably already working on it.

  • How to use the capture and the print button

    I tried to figure out how to use the capture and the "print" button, or add or what you call. I press it and the whole page of a different color changes, so I try to cut the section I want but I don't know how to send it to the printer. Can someone help me with this. I'm not at savvy with tech stuff, but when I find a recipe or something and it doesn't have an option to print a certain area, I can't understand how to use it?

    Thank you

    Andi Starbuck

    That happens to me is, I click and drag to make a rectangle of yellow selection, and as soon as I raise my finger on the mouse button, the part I've selected is captured as an image, a new tab opens and preview before printing, the image display. I can use the installation of the Page or simply print. But if I close the preview, this temporary image vanishes and I'm back on the page where I started. You see something different?

  • How to use the activity monitor to remove MegaBAckup on my mAc Book PRO?

    How to use the activity monitor to remove MegaBAckup on my mAc Book PRO?

    Download and run MalwareBytes. Malwarebytes was developed by one of our colleagues here to ASC. He received rave reviews and is on the more proven anti-malware for Mac software.

  • How to use the utility disk first aid for hard drive internal el captian

    How to use the utility disk first aid for hard drive internal el captian

    Select the drive and click first aid.

    If something is not repairable because this is the system drive, then you need to start using the recovery partition and run disk utility it.

Maybe you are looking for