Help with creating a complex view
Greetings SQL Guru's
We are improving one of our tables for a future release, but we
must support the legacy look and feel of the table because we
have 100's of legacy apps that access the data in the table. The
new system is being deployed with Oracle 10g V10.1.
Our Old REMARKS table that must be turned into a view feed from the new
N_REMARKS table.
UIC varchar2(6) PK
RLT char(3) PK
LABEL varchar2(8) PK
SEQNO number(1) PK
REMARK varchar2(2000) -- Size is From Oracle 7.3.2 which we stil have in prodcution
New Table definition for N_REMARKS (N for new)
UIC varchar2(6) PK
RLT varchar2(3) PK
LABEL varchar2(8) PK
REMARK_TYPE char(1) PK
REMARK CLOB
[pre]
The remark coming in can be up to 5K long. The SEQNO in the org,
definition allows us to break it up into segments. The REMARK data
itself has three remark types (M-mandatory, O-Optional, G-generated)
that are basically concatenated together and then parsed out everytime
they are processed, not very efficient. The need for a remark is based
on other data in the database so as it relates to the REMARKS table each
type may or may not be there.
Our new structure basically stores the individual remark type in their own
row. Our tool has logic to ensure that the aggregated length does not go
over 5K.
I need a view that can aggregate the remarks together and split them in
2K chunks while incrementing the SEQNO.
Say I have remarks in the N_REMARKS table (For simplicity lets say the
REMARKS field length is 50 characters):
If the N_REMARKS table has
[pre]
UIC RLT LABEL REMARK_TYPE REMARKS
XXXXX 123 ABCDE M MANDATORY REMARK SEGMENT
XXXXX 123 ABCDE O OPTIONAL REMARK SEGMENT
XXXXX 123 ABCDE G GENERATED REMARK SEGMENT
YYYYY 345 WXYZ O SECOND OPTIONAL REMARKS
The New REMARKS view should display
UIC RLT LABEL SEQNO REMARKS
XXXXX 123 ABCDE 1 MANDATORY REMARK SEGMENTOPTIONAL REMARK SEGMENTGEN
XXXXX 123 ABCDE 2 ERATED REMARK SEGMENT
YYYYY 345 WXYZ 1 SECOND OPTIONAL REMARKS
[pre]
I had a go, this works for your example (I assumed the remark order is irrelevant, but if not you can change the order by remark_type to order by whatever you want):
1 select uic, rlt, label, rown-1 AS seq, remark
2 from (select uic, rlt, label, trim(r) as r, rown
3 from (select uic,rlt,label,remark_type,to_char(remark) remark,
4 row_number() over (partition by uic, rlt, label order by remark_type) as rown
5 from n_remarks) t
6 model return updated rows
7 partition by (uic, rlt, label)
8 dimension by (rown)
9 measures (remark r)
10 rules
11 (r [ANY] order by rown desc = r[cv(rown)]||r[cv(rown)+1]))
12 where rown=1
13 model return updated rows
14 partition by (uic, rlt, label)
15 dimension by (rown)
16 measures (r remark)
17 rules upsert iterate(100) until (((iteration_number+1)*50)>length(remark[1]))
18* (remark[iteration_number+2]=substr(remark[1],1+(iteration_number*50),50))
UIC RLT LABEL SEQ REMARK
XXXXX 123 ABCDE 1 GENERATED REMARK SEGMENTMANDATORY REMARK SEGMENTOP
XXXXX 123 ABCDE 2 TIONAL REMARK SEGMENT
YYYYY 345 WXYZ 1 SECOND OPTIONAL REMARKSHowever this may fall over depending how long your remarks are (and I guess being clobs they're pretty long - so it probably will). That being the case I think the best solution is a pipelined function, then you can use PL/SQL to easily do what you want.
hth
Martyn
Message was edited by:
martyn
Similar Messages
-
Hey i need help with creating a quiz with scoring and all.
I need a helping hand so if you can get me started that
would help a lot.
Use the Question class to define a Quiz class. A
quiz can be composed of up to 25 questions. Define the add method
of the Quiz class to add a question to a quiz. Define the giveQuiz
method of the Quiz class to present each question in turn to the user,
accept an answer for each one, and keep track of the results. Define
a class called QuizTime with a main method that populates a quiz,
presents it, and prints the final results.
// Question.java Author: Lewis/Loftus/Cocking
// Represents a question (and its answer).
public class Question implements Complexity
private String question, answer;
private int complexityLevel;
// Sets up the question with a default complexity.
public Question (String query, String result)
question = query;
answer = result;
complexityLevel = 1;
// Sets the complexity level for this question.
public void setComplexity (int level)
complexityLevel = level;
// Returns the complexity level for this question.
public int getComplexity()
return complexityLevel;
// Returns the question.
public String getQuestion()
return question;
// Returns the answer to this question.
public String getAnswer()
return answer;
// Returns true if the candidate answer matches the answer.
public boolean answerCorrect (String candidateAnswer)
return answer.equals(candidateAnswer);
// Returns this question (and its answer) as a string.
public String toString()
return question + "\n" + answer;
}Do you know why this lazy fart-ass is back? Because when he posted his homework last week, some sorry-assed idiot went and did it for him.
http://forum.java.sun.com/thread.jspa?threadID=5244564&messageID=10008358#10008358
He didn't even thank the poster.
It's the same problem over and over again. You feed the bears and it only teaches them to come back for handouts.
My polite suggestion to the original poster: please do your own fucking homework. -
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 ();
} -
Help with creating a form, I want to add a check box to enable me to unlock certain fields and deselect the block again
Look to the right under "More Like This". Your issue has been discussed many many times. The error you are seeing is because you do not have enough free "contiguous" space on your hard drive. Read the other threads that address this issue to find how to solve the issue.
Or, put "The disk cannot be partitioned because some files cannot be moved" into the search box at the upper right of this page. -
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
shlomitwhat 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 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? -
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. -
Help with Dreamweaver flash image viewer
Hi all
Would like some help with Dreamweavers Flash image viewer.
Everything is working properly except when i try to link a picture, and have set the imagelinkTarget value to _blank the link always navigates away from my site and does not open in a new window.
I have tried all the values for the imageLinkTarget and nothing works..
Here is my code
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0, 28,0','width','190','height','190','src','images/ad1','quality','high','flashvar s','flashlet={imageLinkTarget:\'_blank\',captionFont:\'Verdana\',titleFont:\'Verdana\',sh owCo ntrols:false,frameShow:false,slideDelay:5,captionSize:14,captionColor:#000000,ti tleSize:10,transitionsType:\'Fade\',titleColor:#333333,slideAutoPlay:true,imageU RLs:[\'images/image1.jpg\',\'images/image2.jpg\',\'images/image3.jpg\',\'images/ image4.jpg\'],slideLoop:true,frameThickness:2,imageLinks:[\'http://www.bowlsaustralia.com.au\',\'http://www.smh.com.au\'],frameColor:#333333,bgColor:# FF9966,imageCaptions:[\'Bowls Australia\',\'Sydney Morning Herald\']}','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFl ash','flash_component','ImageViewer.swc','movie','images/ad1' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0, 28,0" width="190" height="190">
<param name="flash_component" value="ImageViewer.swc" />
<param name="movie" value="images/ad1.swf" />
<param name="quality" value="high" />
<param name="FlashVars" value="flashlet={imageLinkTarget:'_blank',captionFont:'Verdana',titleFont:'Verd ana',showControls:false,frameShow:false,slideDelay:5,captionSize:14,captionColor :#000000,titleSize:10,transitionsType:'Fade',titleColor:#333333,slideAutoPlay:tr ue,imageURLs:['images/image1.jpg','images/image2.jpg','images/image3.jpg','image s/image4.jpg'],slideLoop:true,frameThickness:2,imageLinks:['http://www.bowlsaustralia.com.au','http://www.smh.com.au'],frameColor:#333333,bgColor:#FF9 966,imageCaptions:['Bowls Australia','Sydney Morning Herald']}" />
<embed src="images/ad1.swf" quality="high" flashvars="flashlet={imageLinkTarget:'_blank',captionFont:'Verdana',titleFont:' Verdana',showControls:false,frameShow:false,slideDelay:5,captionSize:14,captionC olor:#000000,titleSize:10,transitionsType:'Fade',titleColor:#333333,slideAutoPla y:true,imageURLs:['images/image1.jpg','images/image2.jpg','images/image3.jpg','i mages/image4.jpg'],slideLoop:true,frameThickness:2,imageLinks:['http://www.bowlsaustralia.com.au','http://www.smh.com.au'],frameColor:#333333,bgColor:#FF9 966,imageCaptions:['Bowls Australia','Sydney Morning Herald']}" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFl ash" type="application/x-shockwave-flash" width="190" height="190"> </embed>
</object>
</noscript>
any help would be greatly appericated
KenI just googled and found lots of folks with the same problem. One fellow wrote this as a soluton:
"All you have to do is
remove the values from the imageLinks in the flash element. That
should fix it."
Does it?
E. Michael Brandt
www.divahtml.com
www.divahtml.com/products/scripts_dreamweaver_extensions.php
Standards-compliant scripts and Dreamweaver Extensions
www.valleywebdesigns.com/vwd_Vdw.asp
JustSo PictureWindow
JustSo PhotoAlbum, et alia -
Hi I am looking to create a view that needs based on a table.
Table:
Roll, Code, Qual, Date
1 05 KO 112010
1 35 01 112010
1 98 01 132011
etc.....
I need only the row(roll) that has code 05 and ko but that roll has to have had a row with Code 35 Qual 01 with the same Date. I am able to get all the rows the have the correct Codes (05 and KO along with 35 and 01). I am not sure how I can then join it on itself to give me just the 05/ko row where the rolls and date match.Hi,
Here's one way, using the analytic COUNT function:
CREATE OR REPLACE VIEW view_y
AS
WITH got_cnt_35 AS
SELECT roll, code, qual, dt -- DATE is not a good column name
, COUNT ( CASE
WHEN code = 35
AND qual = '01'
THEN 1
END
) OVER ( PARTITION BY roll
, dt
) AS cnt_35
FROM table_x
WHERE (code, qual) IN ( ( 5, 'KO')
, (35, '01')
SELECT roll, code, qual, dt
FROM got_cnt_35
WHERE code = 5
AND qual = 'KO'
AND cnt_35 > 0
;You could do it with a self-join, also, but I think this way is simpler.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Point out where the statment above is getting the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
Always say which version of Oracle you're using.
See the forum FAQ {message:id=9360002} -
HELP WITH CREATING A VIEW USING PL/SQL
Hello,
I have two tables, one is simply an audit version of the other and anytime data is updated, modified, or deleted the data is copied to the audit table (via a trigger) and the audit table records who made the changes and when.
Here is the description of one of the archive tables:
AUD_OBLIGATION_ID NOT NULL NUMBER(10)
OBLIGATION_ID NUMBER(10)
COMMUNICATION_ID NUMBER(10)
COMMUNICATION_ID_OLD NUMBER(10)
OBL_DESC VARCHAR2(4000)
OBL_DESC_OLD VARCHAR2(4000)
OBL_TYPE VARCHAR2(20)
OBL_TYPE_OLD VARCHAR2(20)
ORIGINAL_TARGET_DATE DATE
ORIGINAL_TARGET_DATE_OLD DATE
TARGET_DATE DATE
TARGET_DATE_OLD DATE
ACTUAL_DATE DATE
ACTUAL_DATE_OLD DATE
STATUS VARCHAR2(20)
STATUS_OLD VARCHAR2(20)
DOCLINK VARCHAR2(200)
DOCLINK_OLD VARCHAR2(200)
SERIAL_NUMBER NUMBER(10)
SERIAL_NUMBER_OLD NUMBER(10)
REMARKS VARCHAR2(200)
REMARKS_OLD VARCHAR2(200)
CREATED_BY VARCHAR2(10)
CREATED_BY_OLD VARCHAR2(10)
CREATION_TS DATE
CREATION_TS_OLD DATE
MODIFIED_BY VARCHAR2(10)
MODIFIED_BY_OLD VARCHAR2(10)
MODIFICATION_TS DATE
MODIFICATION_TS_OLD DATE
UPDATED_BY VARCHAR2(10)
UPDATED_TS DATE
ACTION_TYPE VARCHAR2(10)
I now need to create a view of this audit table, but do not want to list all the columns from the audit table, instead I would like it to look like this:
Modification_TS ** Action_Type ** Updated_By ** CHANGES
Where CHANGES would be a variable that stores the concatenated new & old values (if they are different).
I assume I need to create a stored procedure using PL/SQL to find these values then insert the values into a view...but all of my efforts do not seem to work.
Here is the procedure I've written:
CREATE OR REPLACE PROCEDURE proc_AUD_OBLIGATIONS AS
modData VARCHAR2(2000) :=' ';
emp VARCHAR2(200);
actType VARCHAR2(100);
actDate DATE;
obUser VARCHAR2(500);
CURSOR cur_AUD_OBLIGATION IS
SELECT o.UPDATED_TS, o.UPDATED_BY, o.OBLIGATION_ID, o.COMMUNICATION_ID,o.COMMUNICATION_ID_OLD,o.OBL_DESC,o.OBL_DESC_OLD,
o.OBL_TYPE, o.OBL_TYPE_OLD, o.ORIGINAL_TARGET_DATE,o.ORIGINAL_TARGET_DATE_OLD,o.TARGET_DATE,o.TARGET_DATE_OLD,
o.ACTUAL_DATE,o.ACTUAL_DATE_OLD,o.STATUS,o.STATUS_OLD,o.DOCLINK,o.DOCLINK_OLD,o.SERIAL_NUMBER,o.SERIAL_NUMBER_OLD,
u.FNAME || ' ' ||u.LNAME AS EMPLOYEE,o.ACTION_TYPE
FROM AUD_OBLIGATION o, TRAC_USER u, OBLIGATION_USER ou
WHERE o.OBLIGATION_ID = ou.OBLIGATION_ID
AND
ou.TRAC_USER_ID = u.TRAC_USER_ID;
i_AUD_OBLIGATION cur_AUD_OBLIGATION%rowtype;
BEGIN
for i_AUD_OBLIGATION in cur_AUD_OBLIGATION loop
actType := i_AUD_OBLIGATION.ACTION_TYPE;
actDate := i_AUD_OBLIGATION.UPDATED_TS;
emp := i_AUD_OBLIGATION.UPDATED_BY;
IF i_AUD_OBLIGATION.OBL_DESC != i_AUD_OBLIGATION.OBL_DESC_OLD
THEN modData := 'OBL. DESC. was: ' || i_AUD_OBLIGATION.OBL_DESC_OLD
|| 'It is now: ' ||i_AUD_OBLIGATION.OBL_DESC;
ELSE modData := modData;
END IF;
IF i_AUD_OBLIGATION.OBL_TYPE != i_AUD_OBLIGATION.OBL_TYPE_OLD
THEN modData := modData || 'OBL. TYPE. was: ' ||i_AUD_OBLIGATION.OBL_TYPE_OLD
|| 'It is now: ' ||i_AUD_OBLIGATION.OBL_TYPE;
ELSE modData := modData;
END IF;
IF i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE != i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE_OLD
THEN modData := modData || 'ORIG.TRGT DATE was: ' || i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE_OLD
|| 'It is now: ' ||i_AUD_OBLIGATION.ORIGINAL_TARGET_DATE;
ELSE modData := modData;
END IF;
INSERT INTO vw_AUD_OBLIGATIONS VALUES
(actDate,actType, emp,modData);
END LOOP;
END;
Here is the view I've created, based on this procedure (it does not compile):
CREATE OR REPLACE VIEW vw_AUD_OBLIGATIONS
(Action_Date, Action_Type, Action_User, Modified_Data)
AS
SELECT actDate,actType, emp,modData
FROM proc_AUD_OBLIGATIONS
END;
Any thoughts on how to make this work - it seems like such a simple concept....
Thanks in advance
TonyYou have a couple of misconceptions here. First, you cannot SELECT from a procedure. You need to write a PROCEDURE that INSERTs these columns into a TABLE, then simply SELECT from the TABLE. There are of course many variations, but I hope you get the general idea here.
Greg -
I Need to create a complex (at least for me !!)view can some body throw some ideas
I have two tables
TABLE-1
NAME SYSTEM DT
AAA GRADE-A DATE
AAA GRADE-B DATE
BBB GRADE-A DATE
BBB GRADE-B DATE
CCC GRADE-B DATE
TABLE-2
NAME SYSTEM DT
DDD GRADE-C DATE
AAA GRADE-C DATE
BBB GRADE-C DATE
CCC GRADE-C DATE
Now I need to create a view with following details.
PV_MYVIEW
CLASS DT
CLASS-A DATE-A
CLASS-B DATE-B
Where as date DATE-A should be oldest date (least) from following
Table-1.date where name=AAA And SYSTEM=GRADE-A
Table-1.date where name=AAA And SYSTEM= GRADE-B
Table-1.date where name=BBB And SYSTEM= GRADE-A
Table-1.date where name=BBB And SYSTEM= GRADE-B
Table-1.date where name=CCC And SYSTEM= GRADE-B
Table-2.date where name=DDD And SYSTEM= GRADE-C
Table-2.date where name=AAA And SYSTEM= GRADE-C
Table-2.date where name=BBB And SYSTEM= GRADE-C
Table-2.date where name=CCC And SYSTEM= GRADE-C
Where as DATE-B should be oldest date (least) from following
Table-1.date where name=AAA And SYSTEM= GRADE-A
Table-1.date where name=AAA And SYSTEM= GRADE-B
Table-1.date where name=BBB And SYSTEM= GRADE-A
Table-1.date where name=BBB And SYSTEM= GRADE-B
Table-2.date where name=AAA And SYSTEM= GRADE-C
Table-2.date where name=BBB And SYSTEM= GRADE-C
As a solution for this, I Am thinking of first creating a intermediate view which comsist
Class, Name and Date and then from this view creating PV_MYVIEW..
Am i in right direction?
THanks in advnce for your timecreating an intermediate view is the worst thing to do!
try this
select
'CLASS-A' class, min(dt) DT
from
select DT from TABLE1
where (name='AAA' And SYSTEM='GRADE-A')
or (name='AAA' And SYSTEM='GRADE-B')
or (name='BBB' And SYSTEM='GRADE-A')
or (name='BBB' And SYSTEM='GRADE-B')
or (name='CCC' And SYSTEM='GRADE-B')
union all
select DT from TABLE2
where (name='AAA' And SYSTEM='GRADE-C')
or (name='BBB' And SYSTEM='GRADE-C')
or (name='CCC' And SYSTEM='GRADE-C')
or (name='DDD' And SYSTEM='GRADE-C')
union all
select
'CLASS-B', min(dt)
from
select DT from TABLE1
where (name='AAA' And SYSTEM='GRADE-A')
or (name='AAA' And SYSTEM='GRADE-B')
or (name='BBB' And SYSTEM='GRADE-A')
or (name='BBB' And SYSTEM='GRADE-B')
union all
select DT from TABLE2
where (name='AAA' And SYSTEM='GRADE-C')
or (name='BBB' And SYSTEM='GRADE-C')
You can for sure remove some duplicate clause and you should verify that the specifications are accurate
REgards
Laurent -
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.
thanksMatt 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 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.comFigured out
-
Help with creating a layout.
I need help creating a layout for my program, but am having tons of problems. I just an't that good at creating this, and it's been driving me insane.
Here's the link to how I want it to look like. http://s94182144.onlinehome.us/randomstuff/layout.JPG
In panel 1... that will be a cartesian plain, so it will pretty much be empty until lines and stuff are drawn in there.
In panel 2, there will be two drop down menus and a couple of buttons
In panel 3, there will be a bunch of things, with two buttons on the bottom.... and this section has to be scrollable.
Any help with the basic layout will be helpful... I can put in the buttons myself. For reference, the whole programs size is 400x800.
Thanks,
sachitRead this section from the Swing tutorial on [url http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html]How to Use Layout Managers. You can combine multiple Layout Managers to get the effect your want. By default the content pane uses the BorderLayout, so one approach might be:
JPanel center = new JPanel(new BorderLayout());
center.add(panel1, BorderLayout.CENTER);
center.add(panel2, BorderLayout.SOUTH);
getContentPane().add(center, BorderLayout.CENTER);
getContentPane().add(panel3, BorderLayout.EAST);
It turn you would layout panel1, panel2 and panel3 with the appropriate layout manager. Panel2 could be something like:
JPanel panel2 = new JPanel( new BorderLayout() );
panel2.add(comboBox1, BorderLayout.WEST);
panel2.add(comboBox2, BorderLayout.EAST);
JPanel bottom = new JPanel();
bottom.add(button1);
buttom.add(button2);
panel.add(bottom, BorderLayout.SOUTH); -
Help with creating a flash banner
Hi,
I need some help with a creating/replicating a flash banner I
saw online. I cant find it anymore but I will do my best to
describe it.
The banner had multiple images layered on top of each other
horizontally. Each image covered the image to the left of it. When
you moused over an image the image expanded to full size while the
other remained contracted.
How can I create something with the above description? Are
there any good tutorials for something like this or maybe someone
can provide me with a few tips/tricks for doing this?
I am proficient in PShop and a beginner with Flash so the
design portion is not the hard part, just the programming/setup in
flash is what has me stumped.
Thanks in advance for any assitance.
Regards,
Mike
Hookah LifeUpdate:
The banner on this template has an exact example of what I am
shooting for.
http://www.algozone.com/zencart-templates-zc03c00287-p-1191.html
Maybe you are looking for
-
Seriously??!!! No alarm volume adjustment on Noki...
Every day, this phone sucks a little more. Can anyone here tell me how to adjust the volume of an alarm sound? I get blasted out of bed each morning, and there's no way I can see to lower the volume. Will this be added to the other things that could
-
With reference sale orde text issue
While creating sale order with reference to exisiting sale order of document type OR , the text should not be copied. What i did is while creating with reference to existing sale order when ever the text comes for copying i will select delete option
-
Can a restore be reversed on an iphone
on iphone can a restore be reversed?
-
DNG Converter no funciona para Nikon D7100
Instalé DNG converter 8.1 en una MAC OS X 10.6.8., y al querer convertir archivos RAW (14 bits) de fotos tomadas con una Nikon D7100, no los reconoce como de formato válido; qué puedo hacer? Gracias.
-
i've noticed on some of my albums that i transfer to my ipod, that it sometimes makes two folders for an artist. gernerally its one song seperated from the others. so when i look at my ipod it lists an artist twice. is there a way to get rid of this?