Is it possible to write in this Way....?

Dear All,
I'm very new to Oracle Pl/SQL
My store proc is as below..
I have a table
Name: test_synch
Note: test_synch has the data that needs to be updated in multiple tables. and it has multi columns along with destination table and column name and new data which I need to update (target table and it's column)
Now I need to update the data from test_synch to taget table (destination tables) and need to convert the datatype of the value according to destination table datatype.
create or replace procedure proc_sec_synch
datatyp char(10);
Begin
FOR lr_Update in (
Select
SsM_ID ,
CYCLE_DATE ,
DESTINATION_TABLE ,
COLUMN_NAME ,
NEW_DATA ,
COLUMN_TYPE from PM_OWN.test_synch order by destination_table )
Loop
datatyp = ('Select DATA_TYPE from all_tab_columns where table_name = ' ||lr_update.destination_table||'and column_name = '||lr_update.column_name||;)
case datatyp
when 'VARCHAR2' then
'Update' || lr_Update.destination_table ||' dest SET dest.' ||lr_Update.column_name||' =
cast( (select src.new_data from test_synch src where src.ssm_id = '||lr_Update.destination_table||'.ssm_id;) as varchar2) where src.ssm_id = '||lr_Update.destination_table||)
END Loop;
END proc_sec_synch
Is this the way to write a proc..? or anyother way..?
Plz Help ME

Naresh wrote:
I tired but still getting error the above mentioned error only.
my doubt is I need to run that statement also dynamically..?
What do you say..?which line is throwing the error?
CREATE OR replace PROCEDURE Proc_sec_synch1
IS
  datatyp CHAR(10);
BEGIN
  FOR lr_update IN (SELECT ssm_id,
                           cycle_date,
                           destination_table,
                           column_name,
                           new_data,
                           column_type
                    FROM   test_synch
                    ORDER  BY destination_table,
                              column_name) LOOP
      SELECT data_type
      INTO   datatyp
      FROM   all_tab_columns
      WHERE  table_name = lr_update.destination_table
             AND column_name = lr_update.column_name;
      IF datatyp = 'VARCHAR2' THEN
EXECUTE IMMEDIATE 'UPDATE '|| lr_update.destination_table
||
' AS dest SET dest.'||lr_update.column_name||' = cast( (select src.new_data from test_synch src where src.ssm_id = '||lr_update.destination_table||'.ssm_id;) as varchar2) where src.ssm_id = '||lr_update.destination_table||'.ssm_id';
END IF;
END LOOP;
COMMIT;
END proc_sec_synch1;  01403, 00000, "no data found"
// *Cause: No data was found from the objects.
// *Action: There was no data from the objects which may be due to end of fetch.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Possible to log data this way?

    Hello, i was wondering if its possible to have data logged onto a file in the following manner. Essentially, whenever someone starts the program, it'll log data into a NEW file everytime they push start. To make sure the file doesn't overwrite itself, I'll use LV's time stamp feature as a string to append itself onto the name of the file. In the end, everytime someone starts the program, it'll have the name of the file followed by the time stamp which will be saved to some directory.
    thank you.

    BurningH34t wrote:
    Hello, i was wondering if its possible to have data logged onto a file in the following manner. Essentially, whenever someone starts the program, it'll log data into a NEW file everytime they push start. To make sure the file doesn't overwrite itself, I'll use LV's time stamp feature as a string to append itself onto the name of the file. In the end, everytime someone starts the program, it'll have the name of the file followed by the time stamp which will be saved to some directory.
    thank you.
    Hello,
    Here is a simple VI which produces new files in a readable timestamped format which will always save files within the same directory as the VI itself.
    This VI saves to a spreadsheet as an example but it could be easily replaced with more file I/O.
    Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)
    Attachments:
    AutoNaming.vi ‏13 KB

  • Is it possible to install Leopard this way?

    I have a Powermac G4 and the DVD drive is shot on it. I only have an external USB DVD drive and just read that it needs to be installed with a Firewire external drive if I go that route.
    My G4 has 2 Hard Drives in it. Is it possible to somehow copy the install disc onto the secondary HD and tell the computer to boot from that volume?

    Yes, you can use the second HD, but it needs to be erased. You use Disk Utility to restore the DVD to the internal HD. Do note that since you're using USB, it'll take quite awhile, but significantly faster than making a .dmg file, which isn't bootable and won't be usable to do the installation. Then, after you do the restoration, System Preferences->Startup Disk->select the newly installed restored disk and click on the Restart button. That should boot into the installer.

  • How to use classloader in this way? Is it possible?

    I have one my own classlaod. So, I can do these: use the classloader to load the class, use the class's newInstance method to get instance object, then use reflection to invoke methods of the object.
    I think this is the standard way.
    However, it is not convenient. Is there a way that allows me to using the class that loaded by my own classload in "old way", i.e. just new to get object, and directly use it. For example, like this:
    ..Get classloader
    class MyClass = loadClass("MyClass");
    MyClass obj = new MyClass();
    obj.someMethod();
    If this way is possible, it is much better. In theory, it should have no problem. I think Java Web Start, etc are just doing similar like this. But, at this point, I do not know. Please share your thoughts.

    You have to distinguish between compile time, and run time features available to you.
    MyClass x = new MyClass() ; is a language construct that is available at compile time.
    Reflection is available at runtime.
    If you want a mix of both, you may have to generate code. Depending on how you like it - you can either generate source and compile it, or generate byte code directly. But since you seem to be interested more in simplifying your code, due to the relative obscurity of reflective code, your best option would be to use a code generator.
    So use your classloader to load the class, then generate and compile code to use it. (This may be even more complex, but this is how you would have to do it)

  • HT1386 When I plug my iPhone into my iMac via USB I can choose to "back up to this computer".  On another sync to my iMac, can I choose to " back up to the iCloud"?  This way I could restore all my info and settings from either source.  Is this possible?

    When I plug my iPhone into my iMac via USB I can choose to "back up to this computer".  On another sync to my iMac, can I choose to " back up to the iCloud"?  This way I could restore all my info and settings from either source.  Is this possible?

    On the phone, under Settings > iCloud you can select to turn iCloud ON or OFF.
    One iTunes, it senses that toggle and if you had selected iCloud it will say backup to iCloud. Here you can change the toggle to backup to computer and click "Apply" prior to syncing.
    I do both for good measure. I backup to computer and then after i disengage the device from the computer, I set the iCloud toggle back to ON and then perform the iCloud backup over wifi.
    I found that using iTunes and saying to backup to iCloud isn't always successful in the "last backed up" time and thus I do it separately.

  • Hi All,this is Prakash Is it possible to write custom markable interface,

    Hi All,Is it possible to write custom markable interface
    Thanks in advance

    Here is a basic exmaple.
    interface ExampleInterface {}
    class ExampleInterfaceImpl implements
    ExampleInterface {
         private boolean doSomething = false;
         public void setDoSomething(boolean doSomething) {
              this.doSomething = doSomething;
         public void doIt() {
              if(doSomething)
              System.out.println("Look! I am doing it!");
    public class Example {
         public static void main(String[] args) {
    ExampleInterfaceImpl exImpl = new
    ew ExampleInterfaceImpl();
              if(exImpl instanceof ExampleInterface) {
                   exImpl.setDoSomething(true);
              exImpl.doIt();
    }Hello George,
    So where is the check performed for say the
    Serializable Interface? that says if Serializable
    then it can be Serialized?
    CheersNot in the JVM

  • I am making a photobook through iPhoto for my Guest Book for guests to sign at my wedding.  I was wondering if it's possible to write on the paper used in the book with ink?  With some photopaper this isn't possible.

    I am making a photobook through iPhoto for my Guest Book for guests to sign at my wedding.  I was wondering if it's possible to write on the paper used in the book with ink?  With some photopaper this isn't possible

    It certainly woujld depend on the pen used - the paper specs are here
    LN

  • Possible to write a function that takes any type as parameter ?

    I need to write a function that will take 2 parameters ( of any type - VARCHAR etc ) and return a boolean.
    ( Im trying to write a function that will do NULL processing.
    something like..
    if ( P1=P2 OR ( P1 IS NULL AND P2 IS NULL ) ) then
    return true ;
    end if;
    return false ;
    the function simply compares its parameters P1 & P2 and returns true if they are equal - including if both are NULL
    Is this possible to write at all.
    My code looks very ugly without this being wrapped in a function.

    You may be able to use SYS.AnyData for this. However, dealing with the data would be confusing, so overloading the FUNCTION would most likely be a better idea.
    This doesn't work, but it looked like fun, so i tried:
    CREATE OR REPLACE FUNCTION Equal_Or_NULL(A SYS.AnyData, B SYS.AnyData)
    RETURN PLS_INTEGER
    AS
    Local_A     VARCHAR2(4000);
    Local_B     VARCHAR2(4000);
    Junk          PLS_INTEGER;
    BEGIN
    IF A IS NULL AND B IS NULL THEN RETURN 1; END IF;
    CASE A.GetTypeName
      WHEN 'SYS.NUMBER'     THEN Junk := A.GetNumber(Local_A); Junk := B.GetNumber(Local_B);
      WHEN 'SYS.DATE'     THEN Junk := A.GetDate(Local_A); Junk := B.GetDate(Local_B);
      WHEN 'SYS.CHAR'     THEN Junk := A.GetCHAR(Local_A); Junk := B.GetCHAR(Local_B);
      WHEN 'SYS.VARCHAR'     THEN Junk := A.GetVARCHAR(Local_A); Junk := B.GetVARCHAR(Local_B);
      WHEN 'SYS.VARCHAR2'     THEN Junk := A.GetVARCHAR2(Local_A); Junk := B.GetVARCHAR2(Local_B);
    END CASE;
    RETURN CASE WHEN Local_A = Local_B THEN 1 ELSE 0 END;
    END Equal_Or_NULL;
    /Overloading would be much simpler, as the arguments could be directly compared.
    IMO, Do not do this. Hiding logic in a FUNCTION it for cosmetic purposes is a bad idea.

  • When I try open a .pdf file my Adobe Reader 11 only allows the download / save opening the related window and don't show me both options 1) open with ... and 2) save as.... probably someone flagged the choise... always perform this way ....

    When I try open a .pdf file my Adobe Reader 11 only allows the download / save opening the related window and don't show me both options 1) open with ... and 2) save as.... probably someone flagged the choise... always perform this way ....
    Could some one give help and let me know where I can probably find the settings option that allows me to change and switch to previous situation where it was possible to decide time to time how to proceed either opening the file or saving it ??
    Thanks in advance
    David

    What is your operating system?
    Open a PDF from where?  If online, in what browser?

  • TS1501 transferring a small batch of photos from the new ipad to macbook pro (this way you can upload one album at a time, file them into a new album on macbook pro)  Pls. advise.

    How can I transfer a small batch of photos from the new ipad to macbook pro?  In theory, I should be able to keep my albums together this way (once uploaded to macbook pro, i can easily file them into a new album on macbook pro.)  Not working for me!  Macbook pro does include iphoto.  I had no problem uploading ALL photos (3 or 4,000.)  Help!  Goal is to keep albums together.

    Hi all,
    Goal:  Backing up photos!
    Hope:  Transfer ALBUMS from ipad to external drive (via macbook pro)
    Is this possible?  Or will I have to create a file name for each of my thousands of photos?
    UGH!
    HELP!
    Lee

  • After download itunes installation began in windowx xp near the end of the installation the message says: it was not possible to write the value to the key Software / Classes / .mpg / OpenWithList / iTunes / .exe. Already reinstalled 3 times and always sa

    After download itunes installation began in windowx xp near the end of the installation the message says: it was not possible to write the value to the key Software / Classes / .mpg / OpenWithList / iTunes / .exe.
    Already reinstalled 3 times and always says the same message.
    thank you

    Only two had virus on windows XP this week and wiped them with Avast. The itunes asked me to install the update, and so I did. but it always gives me that message.

  • IS IT POSSIBLE TO  WRITE ORDER BY CLAUSE WITHIN INNER QUERY

    IS IT POSSIBLE TO WRITE ORDER BY CLAUSE WITHIN INNER QUERY

    So you still can't :) I still don't see it that strict:
    You know of course that this is possible:
    select ename, (select ename
                     from (select   empno, ename
                               from emp
                              where deptno = 10
                           order by 1) e2
                    where e.empno = e2.empno) a
      from emp eso we have an »ORDER BY CLAUSE WITHIN INNER QUERY« which is even correlated (though through the outer query).
    Whether this makes sense or not is not question imho :-) ... but you can

  • Possible to write non HTTP WEB services with an Application Server?

    Is it possible to write services with the backend of an application server in JavaEE 5? Like a server listening for mails? Where does one find information about that? Books only discuss web (html/http) services that you can build in an AS...

    Hi Dugu,
    Can you give the link to the specific article and the version of JDeveloper you are using to help you further?
    One thing to keep in mind is that the accessors must be public - using package access (no modifier) is not going to work.
    Hope this helps,
    Eric

  • Is it possible to write an abap code be SAP SQL query.(ECC 6)

    hello guys,
    Is it possible to write an abap code be SAP SQL query.
    Scenario : table A has a field say f1 of length 10 and table B has a field say s1 of lenght 20. in sap sql i am able to link all the other tables but i am not able to link
    table Af1 --->Table Bs1. as the length doesnot match. so is it possibel that using abap code I can pick 10 characters from table A field f1 adjust it to 20 characters using abap and map it to field s1 of table B.
    Please let me know how to accomplish this if possible.
    thanks in advance!!

    Herm,
    Adding code is done in the infoset.
    Please do following:
    > Goto SQ02
    > Type in the infoset that the basis for your query, <change>
    > Press <code> OR <shift><f8>
    > Tou'll see 4 tabs: Extras, Selections, Code, Enhancements.
    > GoTo tab Code
    > Choose the coding section (<f4> gives you an overview)
    > Enter the code.
    You may set a breakpoint to see what the query in SQ01 will do with it.
    Succes!
    Frank

  • Is it possible to write a program to unzip files in pl/sql or sql ?

    Morning Experts,
    I have a zip file on my Host which contains a list of files(reports). Each of those files have a distinct name and i have already written the codes to retreive data from those files.
    My oracle is installed on a linux server
    Now my question is as follows:
    is it possible to write a program in sql to unzip those .zip files (located on my host) and stores its content in that same folder?
    Thanks

    You can use Java like this:CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "Zipper"
    AS import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import java.util.zip.ZipInputStream;
    import java.util.zip.ZipEntry;
    public class Zipper {
       public static String unzip(byte[] pBuf) throws IOException {
          ZipInputStream in = new ZipInputStream(new ByteArrayInputStream(pBuf));
          ZipEntry ze;
          byte[] buf = new byte[2048];
          StringBuffer stribu = new StringBuffer(pBuf.length * 5);
          while((ze = in.getNextEntry()) != null) {
             int bytesRead;
             while((bytesRead = in.read(buf, 0, 2048)) > 0) {
                for(int i = 0; i < bytesRead; i++) {
                   stribu.append((char)buf);
    in.closeEntry();
    in.close();
    return stribu.toString();
    CREATE OR REPLACE FUNCTION unzip(
    pData IN RAW)
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA
    NAME 'Zipper.unzip(byte[]) return java.lang.String';
    In this example you can pass the content of a reltively small zip file and get the contents as VARCHAR2.
    It's just to show where to start.
    Hth, Urs                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for