I need help with Creating Key Pairs

Hello,
I need help with Creating Key Pairs, I generate key pais with aba provider, but the keys generated are not base 64.
the class is :
import java.io.*;
import java.math.BigInteger;
import java.security.*;
import java.security.spec.*;
import java.security.interfaces.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import au.net.aba.crypto.provider.ABAProvider;
class CreateKeyPairs {
private static KeyPair keyPair;
private static KeyPairGenerator pairGenerator;
private static PrivateKey privateKey;
private static PublicKey publicKey;
public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.out.println("Usage: java CreateKeyParis public_key_file_name privete_key_file_name");
return;
createKeys();
saveKey(args[0],publicKey);
saveKey(args[1],privateKey);
private static void createKeys() throws Exception {
Security.addProvider(new ABAProvider());
pairGenerator = KeyPairGenerator.getInstance("RSA","ABA");
pairGenerator.initialize(1024, new SecureRandom());
keyPair = pairGenerator.generateKeyPair();
privateKey = keyPair.getPrivate();
publicKey = keyPair.getPublic();
private synchronized static void saveKey(String filename,PrivateKey key) throws Exception {
ObjectOutputStream out= new ObjectOutputStream(new FileOutputStream(filename));
out.writeObject(key);
out.close();
private synchronized static void saveKey(String filename,PublicKey key) throws Exception {
ObjectOutputStream out= new ObjectOutputStream( new FileOutputStream(filename));
out.writeObject(key);
out.close();
the public key is:
�� sr com.sun.rsajca.JSA_RSAPublicKeyrC��� xr com.sun.rsajca.JS_PublicKey~5< ~��% L thePublicKeyt Lcom/sun/rsasign/p;xpsr com.sun.rsasign.anm����9�[ [ at [B[ bq ~ xr com.sun.rsasign.p��(!g�� L at Ljava/lang/String;[ bt [Ljava/lang/String;xr com.sun.rsasign.c�"dyU�|  xpt Javaur [Ljava.lang.String;��V��{G  xp   q ~ ur [B���T�  xp   ��ccR}o���[!#I����lo������
����^"`8�|���Z>������&
d ����"B��
^5���a����jw9�����D���D�)�*3/h��7�|��I�d�$�4f�8_�|���yuq ~
How i can generated the key pairs in base 64 or binary????
Thanxs for help me
Luis Navarro Nu�ez
Santiago.
Chile.
South America.

I don't use ABA but BouncyCastle
this could help you :
try
java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
java.security.KeyPairGenerator kg = java.security.KeyPairGenerator.getInstance("RSA","BC");
java.security.KeyPair kp = kg.generateKeyPair();
java.security.Key pub = kp.getPublic();
java.security.Key pri = kp.getPrivate();
System.out.println("pub: " + pub);
System.out.println("pri: " + pri);
byte[] pub_e = pub.getEncoded();
byte[] pri_e = pri.getEncoded();
java.io.PrintWriter o;
java.io.DataInputStream i;
java.io.File f;
o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pub64"));
o.println(new sun.misc.BASE64Encoder().encode(pub_e));
o.close();
o = new java.io.PrintWriter(new java.io.FileOutputStream("d:/pri64"));
o.println(new sun.misc.BASE64Encoder().encode(pri_e));
o.close();
java.io.BufferedReader br = new java.io.BufferedReader(new java.io.FileReader("d:/pub64"));
StringBuffer keyBase64 = new StringBuffer();
String line = br.readLine ();
while(line != null)
keyBase64.append (line);
line = br.readLine ();
byte [] pubBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
br = new java.io.BufferedReader(new java.io.FileReader("d:/pri64"));
keyBase64 = new StringBuffer();
line = br.readLine ();
while(line != null)
keyBase64.append (line);
line = br.readLine ();
byte [] priBytes = new sun.misc.BASE64Decoder().decodeBuffer(keyBase64.toString ());
java.security.KeyFactory kf = java.security.KeyFactory.getInstance("RSA","BC");
java.security.Key pubKey = kf.generatePublic(new java.security.spec.X509EncodedKeySpec(pubBytes));
System.out.println("pub: " + pubKey);
java.security.Key priKey = kf.generatePrivate(new java.security.spec.PKCS8EncodedKeySpec(priBytes));
System.out.println("pri: " + priKey);
catch(Exception e)
e.printStackTrace ();
}

Similar Messages

  • I need help with creating PDF with Preview...

    Hello
    I need help with creating PDF documetns with Preview. Just a few days ago, I was able to create PDF files composed of scanned images (notes) and everything worked perfectly fine. However, today I was having trouble with it. I scanned my notebook and saved 8 images/pages in jpeg format. I did the usual routine with Preview (select all files>print>PDF>save as PDF>then save). Well this worked a few days ago, but when I tried it today, I was able to save it, but the after opening the PDF file that I have saved, only the first page was there. The other pages weren't included. I really don't see anything wrong with what I'm doing. I really need help. Any help would be greatly appreciated.

    I can't find it.  I went into advanced and then document processing but no batch sequence is there and everything is grayed out.
    EDIT: I realized that you cant do batch sequences in standard.  Any other ideas?

  • Need help with creating a brush

    Hi guys,
    I wanted to ask for help with creating a brush (even a link to a tutorial will be goon enough ).
    I got this sample:
    I've created a brush from it, and i'm trying to get this kind of result:
    but it's only duplicates it and gives me this result:
    Can someone help me please understand what i need to define in order to make the brush behave like a continues brush instead of duplicate it?
    Thank you very much
    shlomit

    what you need to do is make a brush that looks like the tip of a brush. photoshop has several already but you can make your own that will be better.
    get a paintbrush and paint a spot kind of like what you did but dont paint a stroke. make it look kindof grungy. then make your brush from that, making sure to desaturate it and everything.
    EDIT:
    oh, and if you bring the fill down to like 10-20% your stroke will look better

  • I need help with creating some formulas

    I'm not sure if anyone around here can help me, but I'm trying to create a Numbers document and need some help with creating a formula/function.
    I have a column of amounts and I would like to create a formula which deducts a percentage (11.9%) and puts the result in another column.
    If anyone can help me, it would be greatly appreciated.

    Here is an example that shows one way to do this:
    The original data is in column A.  In column B we will store formulas to adjust the amounts:
    1) select the cell where you want to formula (in this case cell B2)
    2) Type the "=" (equal sign):
    3) click cell A2:
    4) now type the rest of the formula which is: "*(100-11.9)/100"  that is asterisk, then open parenthesis, 100 minus eleven point nine close parenthesis forward slash  one hundred
    The Asterisk is the multiply operator  (times) and the forward slash is the division operator (divide)
    now hit return.  select cell B2 and hover the cursor over the bottom edge of the cell:
    drag the little yellow dot down to "fill" the formula down as needed.

  • Need help with creating template. Changes are not going through to index.html page

    Hi all,
    I have an issue with my template that I am creating and also a question about creating template Regions (Repeating and Editable).
    Somehow my changes to my index.dwt are not changing my index.html page.
    Also my other question is: For my top navigation bar and left navigation bar links, do I need to select and define each individual button or link as Repeating/Editable Region? or can I just select the whole navigation bar (the one on the top) etc...
    Below are my steps for creating my template...I am kinda fairly new to using DW and this is my first attempt to making a template following the DW tutorial CD that came with DW CS3.
    I appreciate any help with this...regards, Dano
    -Open my index.html file
    -File/save as template
    -Save
    -update links - yes
    -Select Repeating and Editable Regions (I selected the whole top navigation bar and selected Repeating Region and Editable Region, same with the left side navigation links)
    -File close all
    -Open the index.dwt
    -Save as and selected the index.html and chose to overide it..
    When I make changes to my index.dwt it is not changing the index.html
    I feel that I am missing some important steps here.....
    Website address
    www.defenseproshop.com

    Figured out

  • Need help with creating text anchors with tagged text.

    Can anyone tell me how to determine the correct value for a "Hyperlink Dest Index" value?
    I have a script which creates a tagged text file that specifies about about 280 pages of tables (thank heavens for autoflow) , and would like to add live links between different parts. I can create a text anchor and a hyperlink to it in InDesign. The tagged text definition for the link source is simple and in-line and exports and imports nicely as tagged text. However, I see that all the link destinations, aka  text anchors, are all exported at the very end of the tagged text files as global definitions, and thier location iin the document is specified by the property HyperlinkDestIndex. However, I can't figure out how to set this value progammatically. I've spent over an hour exporting links, and it sure isn't anything as obvious as character index in the story.
    Any advice appreciated,
      Read Roberts

    Read, I'm not sure the following is going to help you. It works for external hyperlinks, but you want internal links, right? Anyway, it might give you some clues.
    A funny thing: I was reviewing some script where I got links to work, and I spotted a tiny coding error. Links seemed to be defined by two separate identifiers: a "link name", which is what appears in Edit Hyperlink dialog, and a "Dest Key", which seems to be a simple increasing number. However, due to aformentioned coding error, the dest keys between the actual link and its definition were off by '1', so there was no way that ought to have matched. But it still worked! So "Dest Key" is a red herring ...
    As far as I understand, it works like this (for hyperlinks): in your text, you have
    HplName -- this is actually the 'title' that appears in the Hyperlink palette
    HplDest -- this is the 'internal name'
    DestKey. Hm. Perhaps you could omit this, per above obsvn.
    CharStyleRef, the name of the auto-applied style
    Hid -- seems to be always '0'
    HplOff: the "offset" from this entire command to the start of the hyperlink, in InDesign characters.
    HplLen: the "length" from the hyperlinked text, in InDesign characters.
    and in the list of 'proper' definitions, those that appear at the very end of your file:
    HplDestDfn -- the internal name again
    DestKey -- see above
    HplDestUrl -- finally! A real URL! (But you must escape lots of characters, such as the forward slash and colon.)
    Hid -- again, always seems to be '0'.
    Some of these items are perhaps optional, but experimenting with what may be left out only lead to frustration The Tagged Text guide is far from complete, as I'm sure you already knew.
    As noted, some (or all) of the named items need a backslash escape for a few characters, but I can't find a definitive way to determine in advance what is 'good' and what is 'not good'.
    The following script creates a Tagged Text file with a couple of working hyperlinks in it -- I don't know if this is of any help for your internal links.
    var hyperlinkDest = [];
    var text = "This is some text with a link [http://www.jongware.com/idjshelp.html] and another one [http://forums.adobe.com/thread/1014617?tstart=0] in it.";
    var tagtext = text.replace (/\[(.+?)\]/g, function (full, match)
                        return makelink (match, 'title:'+match, match, match);
    // When done processing plain text, add the destinations at the end:
    tagtext += hyperlinkDest.join('');
    tagFile = File(Folder.myDocuments+'/__tmp.txt');
    if (tagFile.open('w') == false)
              alert ("Unable to create temporary file!");
              exit();
    if (File.fs == "Windows")
              tagFile.write ("<ASCII-WIN>\n");
    else
              tagFile.write ("<ASCII-MAC>\n");
    tagFile.write ("<dcs:HYPERLINK=<cu:1>>\n");
              tagFile.write (tagtext);
    tagFile.close();
    // 'text' is the actual text that will be clickable
    // 'title' is what will appear in the Hyperlinks palette
    // 'name' is the internal name in the Edit Hyperlink dialog
    // 'url' is the actual URL that will be linked to
    function makelink (text, title, name, url)
              var destkey = hyperlinkDest.length;
              // In URL you must escape forward slashes and colons
              // .. and some other characters as well, by the way. There seems to be no list
              url = url.replace(/\//g, '\\/').replace(/:/g, '\\:');
              hyperlinkDest.push ('<HplDestDfn:=<HplDestName:'+name+'><DestKey:'+String(destkey)+'><HplDestUrl:'+url+'><Hid:0>>');
              return '<Hpl:=<HplName:'+title+'><HplDest:'+name+'><DestKey:'+String(destkey)+'><CharStyleRef:HYPERLINK><Hid:0><Brdrv:0><HplOff:0><HplLen:'+String(text.length)+'>>'+text;

  • Need help with generating keys from xml

    Hello,
    I am just learning about JCE and am haveing some problems with implementing a basic program.
    I have the following information:
    <RSAKeyValue>
    <Modulus>Base64EncodedString</Modulus>
    <Exponent>Base64EncodedString</Exponent>
    <P>Base64EncodedString</P>
    <Q>Base64EncodedString</Q>
    <DP>Base64EncodedString</DP>
    <DQ>Base64EncodedString</DQ>
    <InverseQ>Base64EncodedString</InverseQ>
    <D>Base64EncodedString</D>
    </RSAKeyValue>
    From which I need to construct a public and private key. I am using RSA algorithm for the encrypting and decrypting. I am using the org.bouncycastle.jce.provider.BouncyCastleProvider provider. Any help would be greatly appreciated.
    My questions are:
    1) Is it possible to create the public and private key from this data?
    2) How can I construct a public and private key from this data.
    Thank you in advance.
    Sunit.

    Thanks for your help...I am still having problems.
    I am now creating the public and private keys. I am generating the public exp, modulus, private exp, and the encrypted text from another source.
    so my questions are:
    1) How do I verfiy that the private and public keys that I generate are valid?
    2) How do I get the decrypted text back in a readable form?
    3) the decrypted text should read "ADAM"
    Here is a test I wrote:
    _________________STARTCODE_____________________
    import java.security.*;
    import java.security.spec.*;
    import javax.crypto.*;
    import javax.crypto.spec.*;
    import java.math.BigInteger;
    import org.bouncycastle.jce.provider.BouncyCastleProvider;
    public class CryptTester
         protected Cipher encryptCipher = null;
         protected Cipher decryptCipher = null;
         private KeyFactory keyFactory = null;
         protected PublicKey publicKey = null;
         protected PrivateKey privateKey = null;
         private RSAPublicKeySpec publicKeySpec = null;
         private RSAPrivateKeySpec privateKeySpec = null;
         public CryptTester()
              /* Create Cipher for asymmetric encryption (
              * e.g., RSA),
              try
                   encryptCipher = Cipher.getInstance("RSA", "BC");
                   System.out.println("Successfully got encrypt Cipher" );
                   decryptCipher = Cipher.getInstance("RSA", "BC");
                   System.out.println("Successfully got decrypt Cipher" );
                   keyFactory = KeyFactory.getInstance("RSA" , "BC");
                   System.out.println("Successfully got keyFactory" );
              }catch ( NoSuchAlgorithmException nsae)
                   System.out.println("Exception1: " + nsae.toString() );
              catch ( NoSuchPaddingException nspe)
                   System.out.println("Exception2: " + nspe.toString() );
              catch ( java.security.NoSuchProviderException nspe)
                   System.out.println("Exceptiont6: " + nspe.toString() );
              /* Get the private and public keys specs
              BigInteger publicMod = new BigInteger ("86e0ff4b9e95bc6dcbfd6673b33971d4f728218496adcad92021923a9be815ddb7ecf17c06f437634c62fa999a293da90d964172a21d8ce74bd33938994fbd93377f7d83ce93d523782639c75221a3c91b53927a081b2b089a61770c6d112d78d5da8a6abc452d39a276787892080d6cf17dd09537c1ec5551d89567345068ef", 16);
              BigInteger publicExp = new BigInteger ("5");
              BigInteger privateExp = new BigInteger ("50ed65fa2bf3710ead980a456b88dde62de4e0e9", 16);
              publicKeySpec = new java.security.spec.RSAPublicKeySpec( publicMod, publicExp );
              privateKeySpec = new java.security.spec.RSAPrivateKeySpec( publicMod, privateExp);
              try
                   privateKey = keyFactory.generatePrivate(privateKeySpec);
                   publicKey = keyFactory.generatePublic(publicKeySpec);
              }catch ( InvalidKeySpecException ivse)
                   System.out.println("Exception3: " + ivse.toString() );
              try
              * initialize it for encryption with
              * recipient's public key
                   encryptCipher.init(Cipher.ENCRYPT_MODE, publicKey );
                   decryptCipher.init(Cipher.DECRYPT_MODE, privateKey );
         }catch ( InvalidKeyException ivse)
                   System.out.println("Exception4: " + ivse.toString() );
         public String getPublicKey()
              //return new String(publicKey.getEncoded());
              return publicKey.toString();
         public String getPrivateKey()
         //          return new String(privateKey.getEncoded());
              return privateKey.toString();
         public String encryptIt(String toencrypt)
              * Encrypt the message
              try
                   byte [] result = null;
                   try
                        result = encryptCipher.doFinal(toencrypt.getBytes());
                   catch ( IllegalStateException ise )
                        System.out.println("Exception5: " + ise.toString() );
                   return new String(result);
              }catch (Exception e)
                   e.printStackTrace();
              return "did not work";
         public String decryptIt(String todecrypt)
                        * decrypt the message
              try
                   byte [] result = null;
                   try
                        result = decryptCipher.doFinal(todecrypt.getBytes());
                   catch ( IllegalStateException ise )
                        System.out.println("Exception6: " + ise.toString() );
                   return new String(result);
              }catch (Exception e )
                   e.printStackTrace() ;
              return "did not work";
         public static void main(String[] args)
              try
              Security.addProvider(new BouncyCastleProvider());
              CryptTester tester = new CryptTester();
              String encrypted = "307203c3f5827266f5e11af2958271c4";
              System.out.println("Decoding string " + encrypted + "returns : " + tester.decryptIt(encoded) );
              } catch (Exception e)
                   e.printStackTrace();
    _________________ENDPROGRAM_____________________

  • Need Help with creating Line Graph Chart

    I have the following XML Data
    <DATA>
    <PERCENT_ROW>
    <YEAR>2007</YEAR>
    <PERIOD>3</PERIOD>
    <MATERIAL_TYPE>C</MATERIAL_TYPE>
    <BRANCHDESC>Longview</BRANCHDESC>
    <LOCATION>30</LOCATION>
    <QUARTERDESC>Quarter 1</QUARTERDESC>
    <CURRPERIOD>Mar 2007</CURRPERIOD>
    <VALUECURRENTPERIOD>99.9</VALUECURRENTPERIOD>
    <QUARTERVALUE>100</QUARTERVALUE>
    <YTDVALUE>100</YTDVALUE>
    <STDCURRENTPERIOD>99.2</STDCURRENTPERIOD>
    <VARIANCE_STD>-.7</VARIANCE_STD>
    <VARIANCE_STD_PERCENT>-.7</VARIANCE_STD_PERCENT>
    <CURRENT_12MMA>99.97</CURRENT_12MMA>
    <PRIOR_12MMA>0</PRIOR_12MMA>
    <CURRPERSUB1>Feb 2007</CURRPERSUB1>
    <VALUECURRENTPERIODSUB1>100</VALUECURRENTPERIODSUB1>
    <CURRPERSUB2>Jan 2007</CURRPERSUB2>
    <VALUECURRENTPERIODSUB2>100</VALUECURRENTPERIODSUB2>
    <CURRPERSUB3>Dec 2006</CURRPERSUB3>
    <VALUECURRENTPERIODSUB3>0</VALUECURRENTPERIODSUB3>
    <CURRPERSUB4>Nov 2006</CURRPERSUB4>
    <VALUECURRENTPERIODSUB4>0</VALUECURRENTPERIODSUB4>
    <CURRPERSUB5>Oct 2006</CURRPERSUB5>
    <VALUECURRENTPERIODSUB5>0</VALUECURRENTPERIODSUB5>
    <CURRPERSUB6>Sep 2006</CURRPERSUB6>
    <VALUECURRENTPERIODSUB6>0</VALUECURRENTPERIODSUB6>
    <CURRPERSUB7>Aug 2006</CURRPERSUB7>
    <VALUECURRENTPERIODSUB7>0</VALUECURRENTPERIODSUB7>
    <CURRPERSUB8>Jul 2006</CURRPERSUB8>
    <VALUECURRENTPERIODSUB8>0</VALUECURRENTPERIODSUB8>
    <CURRPERSUB9>Jun 2006</CURRPERSUB9>
    <VALUECURRENTPERIODSUB9>0</VALUECURRENTPERIODSUB9>
    <CURRPERSUB10>May 2006</CURRPERSUB10>
    <VALUECURRENTPERIODSUB10>0</VALUECURRENTPERIODSUB10>
    <CURRPERSUB11>Apr 2006</CURRPERSUB11>
    <VALUECURRENTPERIODSUB11>0</VALUECURRENTPERIODSUB11>
    </PERCENT_ROW>
    <PERCENT_ROW>
    <YEAR>2007</YEAR>
    <PERIOD>3</PERIOD>
    <MATERIAL_TYPE>C</MATERIAL_TYPE>
    <BRANCHDESC>Oakland</BRANCHDESC>
    <LOCATION>31</LOCATION>
    <QUARTERDESC>Quarter 1</QUARTERDESC>
    <CURRPERIOD>Mar 2007</CURRPERIOD>
    <VALUECURRENTPERIOD>100</VALUECURRENTPERIOD>
    <QUARTERVALUE>100</QUARTERVALUE>
    <YTDVALUE>100</YTDVALUE>
    <STDCURRENTPERIOD>100</STDCURRENTPERIOD>
    <VARIANCE_STD>0</VARIANCE_STD>
    <VARIANCE_STD_PERCENT>0</VARIANCE_STD_PERCENT>
    <CURRENT_12MMA>100</CURRENT_12MMA>
    <PRIOR_12MMA>0</PRIOR_12MMA>
    <CURRPERSUB1>Feb 2007</CURRPERSUB1>
    <VALUECURRENTPERIODSUB1>100</VALUECURRENTPERIODSUB1>
    <CURRPERSUB2>Jan 2007</CURRPERSUB2>
    <VALUECURRENTPERIODSUB2>100</VALUECURRENTPERIODSUB2>
    <CURRPERSUB3>Dec 2006</CURRPERSUB3>
    <VALUECURRENTPERIODSUB3>0</VALUECURRENTPERIODSUB3>
    <CURRPERSUB4>Nov 2006</CURRPERSUB4>
    <VALUECURRENTPERIODSUB4>0</VALUECURRENTPERIODSUB4>
    <CURRPERSUB5>Oct 2006</CURRPERSUB5>
    <VALUECURRENTPERIODSUB5>0</VALUECURRENTPERIODSUB5>
    <CURRPERSUB6>Sep 2006</CURRPERSUB6>
    <VALUECURRENTPERIODSUB6>0</VALUECURRENTPERIODSUB6>
    <CURRPERSUB7>Aug 2006</CURRPERSUB7>
    <VALUECURRENTPERIODSUB7>0</VALUECURRENTPERIODSUB7>
    <CURRPERSUB8>Jul 2006</CURRPERSUB8>
    <VALUECURRENTPERIODSUB8>0</VALUECURRENTPERIODSUB8>
    <CURRPERSUB9>Jun 2006</CURRPERSUB9>
    <VALUECURRENTPERIODSUB9>0</VALUECURRENTPERIODSUB9>
    <CURRPERSUB10>May 2006</CURRPERSUB10>
    <VALUECURRENTPERIODSUB10>0</VALUECURRENTPERIODSUB10>
    <CURRPERSUB11>Apr 2006</CURRPERSUB11>
    <VALUECURRENTPERIODSUB11>0</VALUECURRENTPERIODSUB11>
    </PERCENT_ROW>
    <PERCENT_ROW>
    <YEAR>2007</YEAR>
    <PERIOD>3</PERIOD>
    <MATERIAL_TYPE>C</MATERIAL_TYPE>
    <BRANCHDESC>Seattle</BRANCHDESC>
    <LOCATION>32</LOCATION>
    <QUARTERDESC>Quarter 1</QUARTERDESC>
    <CURRPERIOD>Mar 2007</CURRPERIOD>
    <VALUECURRENTPERIOD>12.4</VALUECURRENTPERIOD>
    <QUARTERVALUE>18.7</QUARTERVALUE>
    <YTDVALUE>18.7</YTDVALUE>
    <STDCURRENTPERIOD>-2527.7</STDCURRENTPERIOD>
    <VARIANCE_STD>-2540.1</VARIANCE_STD>
    <VARIANCE_STD_PERCENT>100.5</VARIANCE_STD_PERCENT>
    <CURRENT_12MMA>18.7</CURRENT_12MMA>
    <PRIOR_12MMA>0</PRIOR_12MMA>
    <CURRPERSUB1>Feb 2007</CURRPERSUB1>
    <VALUECURRENTPERIODSUB1>37.2</VALUECURRENTPERIODSUB1>
    <CURRPERSUB2>Jan 2007</CURRPERSUB2>
    <VALUECURRENTPERIODSUB2>6.5</VALUECURRENTPERIODSUB2>
    <CURRPERSUB3>Dec 2006</CURRPERSUB3>
    <VALUECURRENTPERIODSUB3>0</VALUECURRENTPERIODSUB3>
    <CURRPERSUB4>Nov 2006</CURRPERSUB4>
    <VALUECURRENTPERIODSUB4>0</VALUECURRENTPERIODSUB4>
    <CURRPERSUB5>Oct 2006</CURRPERSUB5>
    <VALUECURRENTPERIODSUB5>0</VALUECURRENTPERIODSUB5>
    <CURRPERSUB6>Sep 2006</CURRPERSUB6>
    <VALUECURRENTPERIODSUB6>0</VALUECURRENTPERIODSUB6>
    <CURRPERSUB7>Aug 2006</CURRPERSUB7>
    <VALUECURRENTPERIODSUB7>0</VALUECURRENTPERIODSUB7>
    <CURRPERSUB8>Jul 2006</CURRPERSUB8>
    <VALUECURRENTPERIODSUB8>0</VALUECURRENTPERIODSUB8>
    <CURRPERSUB9>Jun 2006</CURRPERSUB9>
    <VALUECURRENTPERIODSUB9>0</VALUECURRENTPERIODSUB9>
    <CURRPERSUB10>May 2006</CURRPERSUB10>
    <VALUECURRENTPERIODSUB10>0</VALUECURRENTPERIODSUB10>
    <CURRPERSUB11>Apr 2006</CURRPERSUB11>
    <VALUECURRENTPERIODSUB11>0</VALUECURRENTPERIODSUB11>
    </PERCENT_ROW>
    <PERCENT_ROW>
    <YEAR>2007</YEAR>
    <PERIOD>3</PERIOD>
    <MATERIAL_TYPE>C</MATERIAL_TYPE>
    <BRANCHDESC>Yakima</BRANCHDESC>
    <LOCATION>33</LOCATION>
    <QUARTERDESC>Quarter 1</QUARTERDESC>
    <CURRPERIOD>Mar 2007</CURRPERIOD>
    <VALUECURRENTPERIOD>36.4</VALUECURRENTPERIOD>
    <QUARTERVALUE>68.2</QUARTERVALUE>
    <YTDVALUE>68.2</YTDVALUE>
    <STDCURRENTPERIOD>-5517.2</STDCURRENTPERIOD>
    <VARIANCE_STD>-5553.6</VARIANCE_STD>
    <VARIANCE_STD_PERCENT>100.7</VARIANCE_STD_PERCENT>
    <CURRENT_12MMA>68.17</CURRENT_12MMA>
    <PRIOR_12MMA>0</PRIOR_12MMA>
    <CURRPERSUB1>Feb 2007</CURRPERSUB1>
    <VALUECURRENTPERIODSUB1>68.6</VALUECURRENTPERIODSUB1>
    <CURRPERSUB2>Jan 2007</CURRPERSUB2>
    <VALUECURRENTPERIODSUB2>99.5</VALUECURRENTPERIODSUB2>
    <CURRPERSUB3>Dec 2006</CURRPERSUB3>
    <VALUECURRENTPERIODSUB3>0</VALUECURRENTPERIODSUB3>
    <CURRPERSUB4>Nov 2006</CURRPERSUB4>
    <VALUECURRENTPERIODSUB4>0</VALUECURRENTPERIODSUB4>
    <CURRPERSUB5>Oct 2006</CURRPERSUB5>
    <VALUECURRENTPERIODSUB5>0</VALUECURRENTPERIODSUB5>
    <CURRPERSUB6>Sep 2006</CURRPERSUB6>
    <VALUECURRENTPERIODSUB6>0</VALUECURRENTPERIODSUB6>
    <CURRPERSUB7>Aug 2006</CURRPERSUB7>
    <VALUECURRENTPERIODSUB7>0</VALUECURRENTPERIODSUB7>
    <CURRPERSUB8>Jul 2006</CURRPERSUB8>
    <VALUECURRENTPERIODSUB8>0</VALUECURRENTPERIODSUB8>
    <CURRPERSUB9>Jun 2006</CURRPERSUB9>
    <VALUECURRENTPERIODSUB9>0</VALUECURRENTPERIODSUB9>
    <CURRPERSUB10>May 2006</CURRPERSUB10>
    <VALUECURRENTPERIODSUB10>0</VALUECURRENTPERIODSUB10>
    <CURRPERSUB11>Apr 2006</CURRPERSUB11>
    <VALUECURRENTPERIODSUB11>0</VALUECURRENTPERIODSUB11>
    </PERCENT_ROW>
    <PERCENT_ROW>
    <YEAR>2007</YEAR>
    <PERIOD>3</PERIOD>
    <MATERIAL_TYPE>C</MATERIAL_TYPE>
    <BRANCHDESC>Twin Falls</BRANCHDESC>
    <LOCATION>34</LOCATION>
    <QUARTERDESC>Quarter 1</QUARTERDESC>
    <CURRPERIOD>Mar 2007</CURRPERIOD>
    <VALUECURRENTPERIOD>100</VALUECURRENTPERIOD>
    <QUARTERVALUE>99.8</QUARTERVALUE>
    <YTDVALUE>99.8</YTDVALUE>
    <STDCURRENTPERIOD>100</STDCURRENTPERIOD>
    <VARIANCE_STD>0</VARIANCE_STD>
    <VARIANCE_STD_PERCENT>0</VARIANCE_STD_PERCENT>
    <CURRENT_12MMA>99.8</CURRENT_12MMA>
    <PRIOR_12MMA>0</PRIOR_12MMA>
    <CURRPERSUB1>Feb 2007</CURRPERSUB1>
    <VALUECURRENTPERIODSUB1>99.4</VALUECURRENTPERIODSUB1>
    <CURRPERSUB2>Jan 2007</CURRPERSUB2>
    <VALUECURRENTPERIODSUB2>100</VALUECURRENTPERIODSUB2>
    <CURRPERSUB3>Dec 2006</CURRPERSUB3>
    <VALUECURRENTPERIODSUB3>0</VALUECURRENTPERIODSUB3>
    <CURRPERSUB4>Nov 2006</CURRPERSUB4>
    <VALUECURRENTPERIODSUB4>0</VALUECURRENTPERIODSUB4>
    <CURRPERSUB5>Oct 2006</CURRPERSUB5>
    <VALUECURRENTPERIODSUB5>0</VALUECURRENTPERIODSUB5>
    <CURRPERSUB6>Sep 2006</CURRPERSUB6>
    <VALUECURRENTPERIODSUB6>0</VALUECURRENTPERIODSUB6>
    <CURRPERSUB7>Aug 2006</CURRPERSUB7>
    <VALUECURRENTPERIODSUB7>0</VALUECURRENTPERIODSUB7>
    <CURRPERSUB8>Jul 2006</CURRPERSUB8>
    <VALUECURRENTPERIODSUB8>0</VALUECURRENTPERIODSUB8>
    <CURRPERSUB9>Jun 2006</CURRPERSUB9>
    <VALUECURRENTPERIODSUB9>0</VALUECURRENTPERIODSUB9>
    <CURRPERSUB10>May 2006</CURRPERSUB10>
    <VALUECURRENTPERIODSUB10>0</VALUECURRENTPERIODSUB10>
    <CURRPERSUB11>Apr 2006</CURRPERSUB11>
    <VALUECURRENTPERIODSUB11>0</VALUECURRENTPERIODSUB11>
    </PERCENT_ROW>
    <PERCENT_ROW>
    <YEAR>2007</YEAR>
    <PERIOD>3</PERIOD>
    <MATERIAL_TYPE>C</MATERIAL_TYPE>
    <BRANCHDESC>Spanish Fork</BRANCHDESC>
    <LOCATION>35</LOCATION>
    <QUARTERDESC>Quarter 1</QUARTERDESC>
    <CURRPERIOD>Mar 2007</CURRPERIOD>
    <VALUECURRENTPERIOD>7.7</VALUECURRENTPERIOD>
    <QUARTERVALUE>10.2</QUARTERVALUE>
    <YTDVALUE>10.2</YTDVALUE>
    <STDCURRENTPERIOD>-6016.2</STDCURRENTPERIOD>
    <VARIANCE_STD>-6023.9</VARIANCE_STD>
    <VARIANCE_STD_PERCENT>100.1</VARIANCE_STD_PERCENT>
    <CURRENT_12MMA>10.23</CURRENT_12MMA>
    <PRIOR_12MMA>0</PRIOR_12MMA>
    <CURRPERSUB1>Feb 2007</CURRPERSUB1>
    <VALUECURRENTPERIODSUB1>14.9</VALUECURRENTPERIODSUB1>
    <CURRPERSUB2>Jan 2007</CURRPERSUB2>
    <VALUECURRENTPERIODSUB2>8.1</VALUECURRENTPERIODSUB2>
    <CURRPERSUB3>Dec 2006</CURRPERSUB3>
    <VALUECURRENTPERIODSUB3>0</VALUECURRENTPERIODSUB3>
    <CURRPERSUB4>Nov 2006</CURRPERSUB4>
    <VALUECURRENTPERIODSUB4>0</VALUECURRENTPERIODSUB4>
    <CURRPERSUB5>Oct 2006</CURRPERSUB5>
    <VALUECURRENTPERIODSUB5>0</VALUECURRENTPERIODSUB5>
    <CURRPERSUB6>Sep 2006</CURRPERSUB6>
    <VALUECURRENTPERIODSUB6>0</VALUECURRENTPERIODSUB6>
    <CURRPERSUB7>Aug 2006</CURRPERSUB7>
    <VALUECURRENTPERIODSUB7>0</VALUECURRENTPERIODSUB7>
    <CURRPERSUB8>Jul 2006</CURRPERSUB8>
    <VALUECURRENTPERIODSUB8>0</VALUECURRENTPERIODSUB8>
    <CURRPERSUB9>Jun 2006</CURRPERSUB9>
    <VALUECURRENTPERIODSUB9>0</VALUECURRENTPERIODSUB9>
    <CURRPERSUB10>May 2006</CURRPERSUB10>
    <VALUECURRENTPERIODSUB10>0</VALUECURRENTPERIODSUB10>
    <CURRPERSUB11>Apr 2006</CURRPERSUB11>
    <VALUECURRENTPERIODSUB11>0</VALUECURRENTPERIODSUB11>
    </PERCENT_ROW>
    </DATA>
    Note that each Branch_Desc has 12 periods called CURRPERIOD,CURPERSUB1,CURPERSUB2 ...... and 12 values for those periods as VALUECURRENTPERIOD, VALUECURRENTPERIODSUB1, VALUECURRENTPERIODSUB2......
    I need to create a Line Graph for each Branch for the 12 periods as defined above where VALUECURRENTPERIOD, VALUECURRENTPERIODSUB1 etc. are the values for that period. The current BIPublisher Chart tool only allows one Value and One Label. In my case I have 12 VALUES (VALUECURRENTPERIOD etc.) and 12 LABELS (CURRPERIOD, CURPERSUB1 etc.). The SERIES or LEGEND should be the Branch Desc . So what I am looking for is to plot values(12 values) for 6 branches (so six lines) over a period of time (12 periods).

    Hi Tim,
    We have this XML data calculated from several tables where the layout was in the format of One account(a Branch in this case) and 12 periodic values for the same . So reformatting the XML is not going to be easy as the source data is like this itself. I tried un-pivioting the table (as this one is already pivoted) but it looks like Oracle doesn't support this feature yet, but is suported in DB2 or SQL. Please take a look at this link
    http://blogs.ittoolbox.com/database/technology/archives/unpivot-query-12798?close=true
    So I am stuck with the data in this format and users want a line graph for each branch over he period of time. May be somone on this forum can figure out how to un-pivot a table in Oracle. Thanks for your help in advance.

  • Need help with creating invoice and list of invoices

    Hello everybody,
    I need to create Credit / Debit memo invoices and for this I try to use FM GN_INVOICE_CREATE in my Z program, please let me know if it is correct way to go?
    As well I need to create list of Credit / Debit memo invoices, how to achieve this?
    Thanks in advance.
    Usefull answers will be awarded.
    Regards, M.

    You can use RV_INVOICE_CREATE for credit memo and debit memo
    list of credit and debit memo - use this FM - RV_INVOICE_LIST_CREATE
    see the below sample code
    refresh: XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS.
      clear  : XKOMFK, XKOMV,
               XTHEAD, XVBFS,
               XVBPA,  XVBRK,
               XVBRP,  XVBSS,
               VBSK_I.
      VBSK_I-SMART = 'F'.
      XKOMFK-VBELN =  v_deliv.
      XKOMFK-VBTYP = 'J'.
      APPEND XKOMFK.
      CALL FUNCTION 'RV_INVOICE_CREATE'
           EXPORTING
                VBSK_I       = VBSK_I
                WITH_POSTING = 'C'
           TABLES
                XKOMFK       = XKOMFK
                XKOMV        = XKOMV
                XTHEAD       = XTHEAD
                XVBFS        = XVBFS
                XVBPA        = XVBPA
                XVBRK        = XVBRK
                XVBRP        = XVBRP
                XVBSS        = XVBSS.
      if sy-subrc eq 0.
        COMMIT WORK.
       flag = 'X'.
      else.
      message i011 with p_vbeln.
      endif.
    Reward Points if it is helpful
    Thanks
    Seshu

  • Need help with creating custom form

    hi all,
    i'm working on creating a new form. it has 2 blocks for 2 tables. headers and lines tables. the headers table mostly have columns that are id's from other tables. i.e. customer_id, location_id etc.. in my screen, obviously i would not show the id's. i'll display the descriptions / names of the id's instead like customer_name for customer_id... but in order to do this i created a table that joins more than 2 tables. so in the block query data source name, i enter the name of this view.. then i add a ON-INSERT, ON-UPDATE, ON-DELETE triggers at block level and i call the corresponding package which does the insert, update and delete. i'm able to insert but update and delete causes a problem. "ORA-01445: cannot select ROWID from, or sample, a join.. ".. i'm thinking the reason is that when the form does an update or delete, it locks the record which causes the error.. also the reason i need the view is because i need to be able to query the customer_name in the screen instead of the customer_id... what i can't figure out is how i can make this work... or a work-around may be...
    can anyone help.
    thanks

    Matt Rasmussen wrote:
    You're right that the form is locking the record so you just need to control how it locks the record with an on-lock trigger. From the Oracle Applications Developer's Guide:
    page 3-9:
    When basing a block on a view, you must code ON–INSERT, ON–UPDATE, ON–DELETE, and ON–LOCK triggers to insert, update, delete, and lock the root table instead of the view.
    Most of the on-lock triggers I have written follow this template:
    <pre>     SELECT     field1, field2, field3
         INTO     :block.field3, :block.field2, :block.field3
         FROM     view
         WHERE     rowid = :block.row_id
         FOR UPDATE OF field1, field2, field3;</pre>
    I think once you've added this trigger, your form will work the way you want it.hi,
    i tried your suggestion but still get the same error.. anyways, here are the details of what i have so far.
    here's my table.
    CREATE TABLE XXPN_VR_VOL_HEADERS_ALL
      VOL_HEADER_ID     NUMBER,
      CUSTOMER_ID       NUMBER,
      LEASE_ID          NUMBER,
      LOCATION_ID       NUMBER,
      VAR_RENT_ID       NUMBER,
      PERIOD_SET_NAME   VARCHAR2(15 BYTE),
      PERIOD_NAME       VARCHAR2(15 BYTE),
      IMPORT_FLAG       VARCHAR2(1 BYTE),
      IMPORT_DATE       DATE,
      CALC_TYPE         VARCHAR2(30 BYTE),
      PASSTHROUGH_FLAG  VARCHAR2(1 BYTE),
      COMMENTS          VARCHAR2(2000 BYTE),
      CREATED_BY        NUMBER,
      CREATION_DATE     DATE,
      LAST_UPDATED_BY   NUMBER,
      LAST_UPDATE_DATE  DATE
    );here's my view.
    create or replace view xxpn_vr_vol_headers_v ( row_id
                                                  ,vol_header_id
                                                  ,customer_id
                                                  ,customer_name
                                                  ,lease_id
                                                  ,lease_name
                                                  ,lease_number
                                                  ,location_id
                                                  ,location_code
                                                  ,var_rent_id
                                                  ,var_rent_number
                                                  ,period_set_name
                                                  ,period_name
                                                  ,import_flag
                                                  ,import_date
                                                  ,calc_type
                                                  ,passthrough_flag
                                                  ,created_by
                                                  ,creation_date
                                                  ,comments
                                                  ,last_updated_by
                                                  ,last_update_date )
    as
      select xvvha.rowid
            ,xvvha.vol_header_id
            ,xvvha.customer_id
            ,hp.party_name
            ,xvvha.lease_id
            ,pl.name
            ,pl.lease_num
            ,xvvha.location_id
            ,loc.location_code
            ,xvvha.var_rent_id
            ,pvr.rent_num
            ,xvvha.period_set_name
            ,xvvha.period_name
            ,xvvha.import_flag
            ,xvvha.import_date
            ,xvvha.calc_type
            ,xvvha.passthrough_flag
            ,xvvha.created_by
            ,xvvha.creation_date
            ,xvvha.comments
            ,xvvha.last_updated_by
            ,xvvha.last_update_date
        from xxpn_vr_vol_headers_all xvvha
            ,hz_parties hp
            ,pn_leases_all pl
            ,pn_locations_all loc
            ,pn_var_rents_v pvr
       where -1 = -1
         and xvvha.customer_id = hp.party_id (+)
         and xvvha.lease_id = pl.lease_id (+)
         and xvvha.location_id = loc.location_id (+)
         and xvvha.var_rent_id = pvr.var_rent_id (+);here's my ON-UPDATE trigger block level
    begin
      xxpn_vr_vol_data_pkg.update_vr_vol_hdr_data ( p_vol_header_id     => :XXPNVRVOLHDRS.vol_header_id
                                                   ,p_customer_id       => :XXPNVRVOLHDRS.customer_id
                                                   ,p_lease_id          => :XXPNVRVOLHDRS.lease_id
                                                   ,p_location_id       => :XXPNVRVOLHDRS.location_id
                                                   ,p_var_rent_id       => :XXPNVRVOLHDRS.var_rent_id
                                                   ,p_period_set_name   => :XXPNVRVOLHDRS.period_set_name
                                                   ,p_period_name       => :XXPNVRVOLHDRS.period_name
                                                   ,p_import_flag       => :XXPNVRVOLHDRS.import_flag
                                                   ,p_passthrough_flag  => :XXPNVRVOLHDRS.passthrough_flag
                                                   ,p_comments          => :XXPNVRVOLHDRS.comments
                                                   ,x_last_updated_by   => :XXPNVRVOLHDRS.last_updated_by
                                                   ,x_last_update_date  => :XXPNVRVOLHDRS.last_update_date );
    end;here's my code in ON-LOCK trigger block level
    begin
      select lease_id
            ,lease_name
            ,lease_number
            ,location_id
            ,location_code
            ,customer_id
            ,customer_name
            ,var_rent_id
            ,var_rent_number
            ,period_name
            ,comments
            ,period_set_name
            ,import_flag
            ,passthrough_flag
            ,created_by
            ,creation_date
            ,last_updated_by
            ,last_update_date
        into :XXPNVRVOLHDRS.lease_id
            ,:XXPNVRVOLHDRS.lease_name
            ,:XXPNVRVOLHDRS.lease_number
            ,:XXPNVRVOLHDRS.location_id
            ,:XXPNVRVOLHDRS.location_code
            ,:XXPNVRVOLHDRS.customer_id
            ,:XXPNVRVOLHDRS.customer_name
            ,:XXPNVRVOLHDRS.var_rent_id
            ,:XXPNVRVOLHDRS.var_rent_number
            ,:XXPNVRVOLHDRS.period_name
            ,:XXPNVRVOLHDRS.comments
            ,:XXPNVRVOLHDRS.period_set_name
            ,:XXPNVRVOLHDRS.import_flag
            ,:XXPNVRVOLHDRS.passthrough_flag
            ,:XXPNVRVOLHDRS.created_by
            ,:XXPNVRVOLHDRS.creation_date
            ,:XXPNVRVOLHDRS.last_updated_by
            ,:XXPNVRVOLHDRS.last_update_date
        from xxpn_vr_vol_headers_v
       where rowid = :XXPNVRVOLHDRS.ROW_ID
         for update of lease_id
                      ,lease_name
                      ,lease_number
                      ,location_id
                      ,location_code
                      ,customer_id
                      ,customer_name
                      ,var_rent_id
                      ,var_rent_number
                      ,period_name
                      ,comments
                      ,period_set_name
                      ,import_flag
                      ,passthrough_flag
                      ,created_by
                      ,creation_date
                      ,last_updated_by
                      ,last_update_date;
    end;properties for the block
    Query Data Source Type: Table
    Query Data Source Name: XXPN_VR_VOL_HEADERS_V
    DML Target Type: Table
    DML Target Name: XXPN_VR_VOL_HEADERS_V
    i'd appreciate any help.
    thanks

  • Need help with creating trigger using instead of insert.

    Hi all,
    I am trying to create a trigger that can read the inserted Mail data from table1 and check if the Mail data matches the Mail data from table2. If the Mail data matches the Mail data from table2 it will get the EmpID from table2 and insert it into table1
    column EmpID. 
    Here are table2 columns:
    EmpID (int) Mail(varchar) Mail2(varchar)
    101 [email protected] [email protected]
    102 [email protected] [email protected]
    table1 columns 
    EmpID (int)(primary key) Mail(varchar) Mail2(varchar)
    If I insert [email protected] into table1 column Mail, I would like it to get the value for the EmpID from table2 before actually inserting the record into table1, by matching the Mail from table1 = Mail from table2.
    I am using ASP.Net to insert the records into Mail and Mail2.
    How can I achieve that?
    I appreciate any help.

    There should be two SQL statements in the stored procedure in order to accomplish the task?
    Ideally you need to include logic as a part of your insert procedure itself. You should have a standard insert stored procedure which should include this logic and should be used for all inserts.
    Also if EmpID field has to have a non NULL value always you may better off creating a foreign key constraint from Table1 to Table2 on EmpID column to enforce the Referential Integrity.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Need help with create trigger based on more then 1 table and join.

    Hello,
    Here i have 3 tables
    1. Employee
    PERSON_ID
    1
    1
    N
    NUMBER
    None
    ORG_ID
    2
    N
    NUMBER
    Frequency
    LOC_ID
    3
    N
    NUMBER
    Frequency
    JOB_ID
    4
    Y
    NUMBER
    Height Balanced
    FLSA_STATUS_ID
    5
    Y
    NUMBER
    Frequency
    FULL_NAME
    6
    N
    VARCHAR2 (250 Byte)
    Height Balanced
    FIRST_NAME
    7
    N
    VARCHAR2 (20 Byte)
    Height Balanced
    MIDDLE_NAME
    8
    Y
    VARCHAR2 (60 Byte)
    Height Balanced
    LAST_NAME
    9
    N
    VARCHAR2 (40 Byte)
    Height Balanced
    PREFERRED_NAME
    10
    Y
    VARCHAR2 (80 Byte)
    None
    EMAIL
    11
    Y
    VARCHAR2 (250 Byte)
    None
    MAILSTOP
    12
    Y
    VARCHAR2 (100 Byte)
    None
    HIRE_DATE
    13
    N
    DATE
    None
    2. ems_candidate
    EMS_CANDIDATE_ID
    1
    1
    N
    NUMBER
    None
    EMS_JOB_ID
    2
    Y
    NUMBER
    Frequency
    NAME
    3
    N
    VARCHAR2 (255 Byte)
    Frequency
    EMAIL
    4
    Y
    VARCHAR2 (255 Byte)
    None
    TELEPHONE
    5
    Y
    VARCHAR2 (25 Byte)
    None
    EMS_SOURCE_ID
    6
    Y
    NUMBER
    Frequency
    RECEIVED_DATE
    7
    Y
    DATE
    Frequency
    COMMENTS
    8
    Y
    VARCHAR2 (4000 Byte)
    None
    3. employee_resources
    EMP_RES_ID
    1
    1
    N
    NUMBER
    None
    PERSON_ID
    2
    Y
    NUMBER
    Height Balanced
    CANDIDATE_ID
    3
    Y
    NUMBER
    Frequency
    EMP_START_DATE
    4
    Y
    DATE
    None
    CUSTOM_RESOURCE_FLAG
    5
    Y
    NUMBER (1)
    None
    RESOURCE_GROUP_ID
    6
    N
    NUMBER
    Frequency
    RESOURCE_STATUS_ID
    7
    N
    NUMBER
    Frequency
    GROUP_LOC_ID
    8
    N
    NUMBER
    Height Balanced
    ASSIGNED_JIRA
    9
    Y
    VARCHAR2 (250 Byte)
    None
    REVOKED_JIRA
    10
    Y
    VARCHAR2 (250 Byte)
    None
    CREATED_DATE
    11
    Y
    DATE
    SYSDATE
    None
    UPDATED_DATE
    12
    Y
    DATE
    None
    Now i want to create trigger when new record get inserted in employee table wanted to update person_id in employee_resources table.
    So i want to match ems_candidate.name with employee.full_name , ems_candidate.ems_job_id with employee.ems_job_id. And if it matched then update person_id in employee_resources table else through an exception and insert record in temp table.
    If anybody has an idea can u please help me.
    Thanks,
    Gayatri.

    I created below trigger
    CREATE TRIGGER emp_resources_upd_person_id
    AFTER INSERT ON ems.employee
    FOR EACH ROW
    BEGIN
        UPDATE ems.employee_resources
           SET person_id = :new.person_id
         WHERE candidate_id = (SELECT ems_candidate_id  
                                 FROM ems.ems_candidate cand, ems.employee emp
                                WHERE TRIM(UPPER(emp.first_name)) = TRIM(UPPER(SUBSTR (cand.name, 1, INSTR (cand.name, ' ') - 1)))
                                  AND TRIM(UPPER(emp.last_name)) = TRIM(UPPER(SUBSTR (cand.name,INSTR (cand.name, ' ') + 1,DECODE (INSTR (SUBSTR (cand.name, INSTR (cand.name, ' ') + 1), ' '),0,LENGTH (cand.name),(INSTR (SUBSTR (cand.name, INSTR (cand.name, ' ') + 1), ' ') - 1)))))
                                  AND emp.person_id = :new.person_id);
    EXCEPTION
      WHEN OTHERS THEN
        INSERT INTO ems.update_person_id_exception(person_id,first_name,last_name,full_name) VALUES(:new.person_id,:new.first_name,:new.last_name,:new.full_name);
    END;
    Now when i am trying to insert row in ems.employee  table it gives me an error
    ORA-04091
    table string.string is mutating, trigger/function may not see it
    Cause: A trigger (or a user defined plsql function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it.
    Action: Rewrite the trigger (or function) so it does not read that table.
    Can anybody please help me to come out from these error.
    Thanks,
    Gayatri.

  • Need help with creating table that automatically inserts rows depending on the amount of data

    Hi there,
    I'm trying to create a table for supervisors to enter in their subordinates information and will automatically insert rows for supervisors with multiple subordinates.  This form will not be connected to a data source, the supervisors will simply fill in the form and print out.  I want it to kind of look like this:
    Name
    Position #
    Classification
    Hours
    I really appreciate any help.  Thanks!

    Hi Niall,
    You figured it out!  I didn't have javascript turned on.  Now it is working perfectly.  I think this will help me tremendously.  Thanks so much for your help!!!!!
    Laura

  • Need Help with Creating the SQl query

    Hi,
    SQL query gurus...
    INFORMATION:
    I have two table, CURRENT and PREVIOUS.(Table Defs below).
    CURRENT:
    Column1 - CURR_PARENT
    Column2 - CURR_CHILD
    Column3 - CURR_CHILD_ATTRIBUTE 1
    Column4 - CURR_CHILD_ATTRIBUTE 2
    Column5 - CURR_CHILD_ATTRIBUTE 3
    PREVIOUS:
    Column1 - PREV_PARENT
    Column2 - PREV_CHILD
    Column3 - PREV_CHILD_ATTRIBUTE 1
    Column4 - PREV_CHILD_ATTRIBUTE 2
    Column5 - PREV_CHILD_ATTRIBUTE 3
    PROBLEM STATEMENT
    Here the columns 3 to 5 are the attributes of the Child. Lets assume that I have two loads, One Today which goes to the CURRENT table and one yesterday which goes to the PREVIOUS table. Between these two loads there is a CHANGE in the value for Columns either 3/4/5 or all of them(doesnt matter if one or all).
    I want to determine what properties for the child have changed with the help of a MOST efficient SQL query.(PARENT+CHILD is unique key). The Database is ofcourse ORACLE.
    Please help.
    Regards,
    Parag

    Hi,
    The last message was not posted by the same user_name that started the thread.
    Please don't do that: it's confusing.
    Earlier replies give you the information you want, with one row of output (maximum) per row in current_tbl. There may be 1, 2 or 3 changes on a row.
    You just have to unpivot that data to get one row for every change, like this:
    WITH     single_row  AS
         SELECT     c.curr_parent
         ,     c.curr_child
         ,     c.curr_child_attribute1
         ,     c.curr_child_attribute2
         ,     c.curr_child_attribute3
         ,     DECODE (c.curr_child_attribute1, p.prev_child_attribute1, 0, 1) AS diff1
         ,     DECODE (c.curr_child_attribute2, p.prev_child_attribute2, 0, 2) AS diff2
         ,     DECODE (c.curr_child_attribute3, p.prev_child_attribute3, 0, 3) AS diff3
         FROM     current_tbl    c
         JOIN     previous_tbl   p     ON  c.curr_parent     = p.prev_parent
                                AND c.curr_child     = p.prev_child
         WHERE     c.curr_child_attribute1     != p.prev_child_attribute1
         OR     c.curr_child_attribute2     != p.prev_child_attribute2
         OR     c.curr_child_attribute3     != p.prev_child_attribute3
    ,     cntr     AS
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= 3
    SELECT     s.curr_parent     AS parent
    ,     s.curr_child     AS child
    ,     CASE     c.n
              WHEN  1  THEN  s.curr_child_attribute1
              WHEN  2  THEN  s.curr_child_attribute2
              WHEN  3  THEN  s.curr_child_attribute3
         END          AS attribute
    ,     c.n          AS attribute_value
    FROM     single_row     s
    JOIN     cntr          c     ON     c.n IN ( s.diff1
                                    , s.diff2
                                    , s.diff3
    ORDER BY  attribute_value
    ,            parent
    ,            child
    ;

  • No primary key in database table.Need help with ODS keys.

    Hi ,
    I am pulling data from a database table where there in no primary key . So when I designed my ODS and loaded the data , the records got overwritten...(If there are 5000 records only 4000 got transfered) . So Now the only option I can think of is putting all the database fields as key fields in my ODS but then I am restricted to only 16 fields for ODS and I have more than 24 fields in my database table.What should I do now.Any help will be appreciated.
    Thanks a lot!!!

    Hi,
    are you trying to pull data from structures.....putting all the fields in the key fields is the ODS keys is not a solution.
    what is your reporting requirement....try to maintain the keys for which you want to see the data
    e.g. if in report you want to see the data for sales order then put the keys as sales order for ODS...so that the data is correct at the sales order level.
    ie. the try to maintain the ODS at the level ...which can be used.
    This is the just a guide....you can decide with your requirement.
    Thanks

Maybe you are looking for