Help with update statement
Create table temp_sibs as
(select 1701 sib_1, 1702 sib_2 from dual
union all
select 1171,1172 from dual
union all
select 1701,1172 from dual
union all
select 1171,1174 from dual
union all
select 1173,1176 from dual
union all
select 2001,2004 from dual
union all
select 2001,2006 from dual
union all
select 2002,2006
from dual)
create table temp_sib_data as
(select 111 pid, 1701 sibid, 5 amt from dual
union all
select 111 pid, 1176 sibid, 5 from dual
union all
select 222 pid, 2006 sibid, 5 from dual
union all
select 333 pid, 2001 sibid, 5 from dual
union all
select 333 pid, 2002 sibid, 5 from dual
union all
select 333 pid, 1171 sibid, 5 from dual
First table is a lookup table that defines relationships sib_1 is related to sib_2
Second table consists of a column pid and column sibid which is either sib_1 or sib_2
The user would pass parameter pid and sibid and I want to update all the related rows with any matching sibid to 0.
It is like 1701 matches with 1702 and 1701 matches with 1174 so indirectly 1701 and 1174 match...and 1171 matches because
1171 matches with 1174
so all 1701,1702,1171,1172, 1173,1174,1176 match (indirectly with each other)
So for example if the user passes 333 pid and 2001 rows with 333,2001 and 333,2002 should update the amt to 0
and if the user passes 111 and 1176 than 1st 2 rows should be updated to 0.
Hi,
try this:
DEFINE PID='333'
DEFINE sibid='2001'
-- SELECT is only for test.
-- Replace SELECT with: UPDATE TEMP_SIB_DATA SET AMT = 0
SELECT * FROM TEMP_SIB_DATA
WHERE PID = &PID AND SIBID IN (
WITH TEMP AS(
SELECT SIB_1, SIB_2 FROM TEMP_SIBS
START WITH SIB_1 = &&SIBID OR SIB_2 = &&SIBID
CONNECT BY NOCYCLE PRIOR SIB_2 = SIB_1
OR PRIOR SIB_1 = SIB_2
OR SIB_2 = PRIOR SIB_2
OR SIB_1 = PRIOR SIB_1
SELECT SIB_1 FROM TEMP
UNION ALL
SELECT SIB_2 FROM TEMP
);For pid=333 and sibid=2001 it returns desired records for update:
PID SIBID AMT
333 2001 5
333 2002 5For pid=111 and=1176 it returns one row - 1176 matches only with 1173 and 1173 doesn't match with any other rows,
so only 5th row, not first 2, should be updated ... maybe I missed something ?
PID SIBID AMT
111 1176 5
Similar Messages
-
Need help with update statement with multiple joins
I've got the following select statement that is pulling 29 records:
SELECT
PPA.PROJECT_ID,
PPA.SEGMENT1,
peia.expenditure_item_id,
peia.expenditure_type,
pec.expenditure_comment
FROM PA.PA_PROJECTS_ALL PPA,
pa.pa_expenditure_items_all peia,
pa.pa_expenditure_comments pec
where PPA.segment1 < '2008' and
PPA.project_id = 52 and -- just run for project # 20077119 for testing
peia.expenditure_type = 'PAYROLL' and
peia.project_id = ppa.project_id and
PEC.EXPENDITURE_ITEM_ID = PEIA.EXPENDITURE_ITEM_ID;
I need to update the pec.expenditure_comments to a static field for those 29 records. I assume I should start with the following, but not sure how to complete the where:
update
pa.pa_expenditure_comments pec
set pec.expenditure_comment = 'REFERENCE HD#728'
where
First time that we've ever needed to update, so any and all help appreciated.Try using exists:
update pa.pa_expenditure_comments pec
set pec.expenditure_comment = 'REFERENCE HD#728'
where exists ( select null
from pa.pa_projects_all ppa
, pa.pa_expenditure_items_all peia
, pa.pa_expenditure_comments pec2
where ppa.segment1 < '' -- not sure what you posted here, so for next time:
-- please put your examples between the code tags.
and ppa.project_id = 52 -- just run for project # 20077119 for testing
and peia.expenditure_type = 'PAYROLL'
and peia.project_id = ppa.project_id
and pec2.expenditure_item_id = peia.expenditure_item_id
and pec2.expenditure_item_id = pec.expenditure_item_id
); -
I need help installing latest updates for CS6. I have Win 7 and have tried updating from the Help - Updates menu. The error is: U43M1D207.
Thanks for your response. I am in the United States in So. Arizona.
Date: Fri, 5 Oct 2012 12:21:45 -0600
From: [email protected]
To: [email protected]
Subject: Help with updates for CS6
Re: Help with updates for CS6 created by Jeff A Wright in Downloading, Installing, Setting Up - View the full discussion
Crunkle1 you are welcome to work directly with our support team for guided assistance. If you go to http://www.adobe.com/ and select Help and Contact Us you should be given the option to contact our support team via telephone. Which country/region are you in?
Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4752605#4752605
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/4752605#4752605
To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/4752605#4752605. In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Downloading, Installing, Setting Up by email or at Adobe Community
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746. -
MAC OS 10.6.8 Using Safari 5.1 Needing Help With Updating Adobe Flash
Hello-
Recently Adobe Flash installed an icon in my System Preferences and when I click the icon there are several tabs. One allows updates to check automatically. It says it will install the latest version of Flash without having to remove the previous version, but I have never been told that a newer version is available unless I clcik "check now." although "Check for updates automatically" is checked, I do not know where it tells me a newer version is available. Also, there has been 5 "newer versions" available since this icon was installed in System Prefeences, I have only found out about the newer versions when I clicked "Check Now." If I read that with this new way to install the latest Mac version of Flash does not require me to uninstall the previous version of Flash how do I install the most recent version of Flash? Does it come in an email?
Since it is not telling me that there is a more recent version of Flash unless I click "Check Now" should I still do it the way I used to install the latest version of flash? (The way before this icon was added to System Preferences)?
I would appreciate help with updating Flash to the most recent version. I used to uninstall the older version, restart the browser and download the most recent version and install it. It always worked find but this was before there was an Adobe icon in my system Preferences.Hello,
The way you used to do this (uninstall, restart the browser, etc.) is still definitely valid and probably the "safest" way to get a new version installed. Uninstalling shouldn't be required, but it definitely doesn't hurt. If you feel comfortable doing it the old way, please feel free to continue using that process.
As for notifications, this is a bit trickier, but in general you should be notified within 30 days (or so) after a new player is released. This usually occurs when the browser loads swf content. Clicking the button will, like you mention, immediately check. Another alternative to finding out when a new player is released is to subscribe to our Flash Player Releases feed.
Is there a way to be automatically notified when a new Flash Runtime release is made?
Thanks,
Chris -
HT201541 I need help with updating my browser.
I need help with updating my browser. Its telling me that Safari is outdated.
That is a very old version belonging to Snow Leopard. I take it you are not actually running Yosemite.
Upgrading to Yosemite
You can upgrade to Yosemite from Lion or directly from Snow Leopard. Yosemite can be downloaded from the Mac App Store for FREE.
Upgrading to Yosemite
To upgrade to Yosemite you must have Snow Leopard 10.6.8 or Lion installed. Download Yosemite from the App Store. Sign in using your Apple ID. Yosemite is free. The file is quite large, over 5 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
OS X Mavericks/Yosemite- System Requirements
Macs that can be upgraded to OS X Yosemite
1. iMac (Mid 2007 or newer) - Model Identifier 7,1 or later
2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) - Model Identifier 5,1 or later
3. MacBook Pro (Mid/Late 2007 or newer) - Model Identifier 3,1 or later
4. MacBook Air (Late 2008 or newer) - Model Identifier 2,1 or later
5. Mac mini (Early 2009 or newer) - Model Identifier 3,1 or later
6. Mac Pro (Early 2008 or newer) - Model Identifier 3,1 or later
7. Xserve (Early 2009) - Model Identifier 3,1 or later
To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
Are my applications compatible?
See App Compatibility Table - RoaringApps.
Upgrading to Lion
If your computer does not meet the requirements to install Mavericks, it may still meet the requirements to install Lion.
You can purchase Lion at the Online Apple Store. The cost is $19.99 (as it was before) plus tax. It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
Lion System Requirements
1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
or Xeon processor
2. 2GB of memory
3. OS X v10.6.6 or later (v10.6.8 recommended)
4. 7GB of available space
5. Some features require an Apple ID; terms apply. -
I have rolled out bunch of updates across few hundred workstation systems.
Few of the desktops have failed to install SOME of the updates and just can't get my head around as to why?
Looking at one of the workstations, I can see 5 updates are pending download at 0%.
Some of these fail after a while and with in Software Centre, I can see 'Help with updates - The software change returned error code 0x87D00215(-2016411115).'. Not exactly sure what this means, but I have tried clearing the cache and
rebooting the workstations few times.
(I have also tried to use Windows Update and install one of these manually, which worked.)Investigating this further, I have found the following in CAS.log:
ICcmContentTransferManager::ModifyJobPriority failed with error 0x87d00215 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
No need to change timeout settings ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Successfully created download request {ED6E9E5C-E806-43CA-9F93-49AC72D1DEAD} for content 53bf87a2-bedf-4def-b0ec-9637613c3429.1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Requesting locations synchronously for content 99ddb078-b780-4605-8fac-9607fe56450d.1 with priority Foreground ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
The number of discovered DPs(including Branch DP and Multicast) is 1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Calling back with the following distribution points ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Distribution Point='http://DPSERVER.com/SMS_DP_SMSPKG$/99ddb078-b780-4605-8fac-9607fe56450d', Locality='LOCAL' ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Requesting content 99ddb078-b780-4605-8fac-9607fe56450d.1, size(KB) 0, under context System with priority Foreground ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
ICcmContentTransferManager::ModifyJobPriority failed with error 0x87d00215 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
No need to change timeout settings ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Successfully created download request {67B7E59B-A386-4EA8-BF39-2EB64B108A6C} for content 99ddb078-b780-4605-8fac-9607fe56450d.1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Requesting locations synchronously for content 61d33de7-9582-41e3-82fc-3e0f970b60f3.1 with priority Foreground ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
The number of discovered DPs(including Branch DP and Multicast) is 1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Calling back with the following distribution points ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Distribution Point='http://DPSERVER.com/SMS_DP_SMSPKG$/61d33de7-9582-41e3-82fc-3e0f970b60f3', Locality='LOCAL' ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Requesting content 61d33de7-9582-41e3-82fc-3e0f970b60f3.1, size(KB) 0, under context System with priority Foreground ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
ICcmContentTransferManager::ModifyJobPriority failed with error 0x87d00215 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
No need to change timeout settings ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4)
Successfully created download request {12E48136-B545-4C42-9745-9FF97CE38D52} for content 61d33de7-9582-41e3-82fc-3e0f970b60f3.1 ContentAccess 01/06/2013 17:19:24 3316 (0x0CF4) -
Help needed with Update statements.
Hello All,
I am trying to learn Berkeley XMLDB and facing problem to query the inserted XML file. I have a small XML file with the following contents:
<?xml version="1.0" standalone="yes"?>
<Bookstore>
<Book>
<book_ID>1</book_ID>
<title>Harry Potter and the Order of the Phoenix</title>
<subtitle>A Photographic History</subtitle>
<author>
<author_fname>J.K.</author_fname>
<author_lname>Rowling</author_lname>
</author>
<price>9.99</price>
<year_published>2004</year_published>
<publisher>Scholastic, Inc.</publisher>
<genre>Fiction</genre>
<quantity_in_stock>28997</quantity_in_stock>
<popularity>20564</popularity>
</Book>
</Bookstore>
When I try to update the TITLE of this node I have the following error message:
C:\Users\Chandra\Desktop\BDB>javac -classpath .;"C:\Program Files\Sleepycat Soft
ware\Berkeley DB XML 2.1.8\jar\dbxml.jar";"C:\Program Files\Sleepycat Software\B
erkeley DB XML 2.1.8\jar\db.jar" bdb.java
bdb.java:75: illegal start of expression
public static final String STATEMENT1 = "replace value of node collection("twopp
ro.bdbxml")/Bookstore/Book/bookid/title with 'NEWBOOK'";
^
bdb.java:80: ')' expected
System.out.println("Done query: " + STATEMENT1);
^
2 errors
But when I remove the update statements and just try to display the TITLE of this node, I dont see any outputs. Please help me to catch up with my mistakes. Below is source code I am using to run this functionality.
Thanks.
import java.io.File;
import java.io.FileNotFoundException;
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.Environment;
import com.sleepycat.db.EnvironmentConfig;
import com.sleepycat.dbxml.XmlContainer;
import com.sleepycat.dbxml.XmlException;
import com.sleepycat.dbxml.XmlInputStream;
import com.sleepycat.dbxml.XmlManager;
import com.sleepycat.dbxml.XmlUpdateContext;
import com.sleepycat.dbxml.XmlDocument;
import com.sleepycat.dbxml.XmlQueryContext;
import com.sleepycat.dbxml.XmlQueryExpression;
import com.sleepycat.dbxml.XmlResults;
import com.sleepycat.dbxml.XmlValue;
public class bdb{
public static void main(String[] args)
Environment myEnv = null;
File envHome = new File("D:/xmldata");
try {
EnvironmentConfig envConf = new EnvironmentConfig();
envConf.setAllowCreate(true); // If the environment does not
// exits, create it.
envConf.setInitializeCache(true); // Turn on the shared memory
// region.
envConf.setInitializeLocking(true); // Turn on the locking subsystem.
envConf.setInitializeLogging(true); // Turn on the logging subsystem.
envConf.setTransactional(true); // Turn on the transactional
envConf.setRunRecovery(true);
// subsystem.
myEnv = new Environment(envHome, envConf);
// Do BDB XML work here.
} catch (DatabaseException de) {
// Exception handling goes here
} catch (FileNotFoundException fnfe) {
// Exception handling goes here
} finally {
try {
if (myEnv != null) {
myEnv.close();
} catch (DatabaseException de) {
// Exception handling goes here
XmlManager myManager = null;
XmlContainer myContainer = null;
// The document
String docString = "D:/xmldata/test.xml";
// The document's name.
String docName = "cia";
try {
myManager = new XmlManager(); // Assumes the container currently exists.
myContainer =
myManager.createContainer("twoppro.bdbxml");
myManager.setDefaultContainerType(XmlContainer.NodeContainer); // Need an update context for the put.
XmlUpdateContext theContext = myManager.createUpdateContext(); // Get the input stream.
XmlInputStream theStream =
myManager.createLocalFileInputStream(docString); // Do the actual put
myContainer.putDocument(docName, // The document's name
theStream, // The actual document.
theContext, // The update context
// (required).
null); // XmlDocumentConfig object
theStream.delete();
// Update the title
public static final String STATEMENT1 = "*replace value of node collection("twoppro.bdbxml")/Bookstore/Book/[bookid=1]/title with 'NEWBOOK'";*
XmlQueryContext context = myManager.createQueryContext();
XmlQueryExpression queryExpression1 = myManager.prepare(STATEMENT1, context);
System.out.println("Try to execute query: " +
System.out.println("Done query: " + STATEMENT1);
queryExpression1.execute(context);
// Get a query context
XmlQueryContext context = myManager.createQueryContext();
// Set the evaluation type to Lazy.
context.setEvaluationType(XmlQueryContext.Lazy);
// Declare the query string
String queryString =
"for $u in collection('twoppro.dbxml')/Bookstore/Book/[bookid=1]"
+ "*return $u/title";*
// Prepare (compile) the query
XmlQueryExpression qe = myManager.prepare(queryString, context);
XmlResults results = qe.execute(context);
System.out.println("ok");
System.out.println(results);
} catch (XmlException e) {
// Error handling goes here. You may want to check
// for XmlException.UNIQUE_ERROR, which is raised
// if a document with that name already exists in
// the container. If this exception is thrown,
// try the put again with a different name, or
// use XmlModify to update the document.
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (myContainer != null) {
myContainer.close();
if (myManager != null) {
myManager.close();
} catch (XmlException ce) {
// Exception handling goes hereThanks Rucong. The change you suggested did helped me to run the program correct. But I also have the display function to retrive the results and my program is parsed without any output.
C:\Users\C\Desktop\BDB>Clientbuild.bat
C:\Users\C\Desktop\BDB>javac -classpath .;"C:\Program Files\Sleepycat Soft
ware\Berkeley DB XML 2.1.8\jar\dbxml.jar";"C:\Program Files\Sleepycat Software\B
erkeley DB XML 2.1.8\jar\db.jar" bdb.java
C:\Users\C\Desktop\BDB>Client.bat
C:\Users\C\Desktop\BDB>java -classpath .;"C:\Program Files\Sleepycat Softw
are\Berkeley DB XML 2.1.8\jar\dbxml.jar";"C:\Program Files\Sleepycat Software\Be
rkeley DB XML 2.1.8\jar\db.jar" bdb
See there is no OUPUT displayed. Is there somethinglike a 'print' I have to use in this java code.
Any ideas ? Below is the code I am using now
import java.io.File;
import java.io.FileNotFoundException;
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.Environment;
import com.sleepycat.db.EnvironmentConfig;
import com.sleepycat.dbxml.XmlContainer;
import com.sleepycat.dbxml.XmlException;
import com.sleepycat.dbxml.XmlInputStream;
import com.sleepycat.dbxml.XmlManager;
import com.sleepycat.dbxml.XmlUpdateContext;
import com.sleepycat.dbxml.XmlDocument;
import com.sleepycat.dbxml.XmlQueryContext;
import com.sleepycat.dbxml.XmlQueryExpression;
import com.sleepycat.dbxml.XmlResults;
import com.sleepycat.dbxml.XmlValue;
public class bdb{
public static void main(String[] args)
Environment myEnv = null;
File envHome = new File("D:/xmldata");
try {
EnvironmentConfig envConf = new EnvironmentConfig();
envConf.setAllowCreate(true); // If the environment does not
// exits, create it.
envConf.setInitializeCache(true); // Turn on the shared memory
// region.
envConf.setInitializeLocking(true); // Turn on the locking subsystem.
envConf.setInitializeLogging(true); // Turn on the logging subsystem.
envConf.setTransactional(true); // Turn on the transactional
envConf.setRunRecovery(true);
// subsystem.
myEnv = new Environment(envHome, envConf);
// Do BDB XML work here.
} catch (DatabaseException de) {
// Exception handling goes here
} catch (FileNotFoundException fnfe) {
// Exception handling goes here
} finally {
try {
if (myEnv != null) {
myEnv.close();
} catch (DatabaseException de) {
// Exception handling goes here
XmlManager myManager = null;
XmlContainer myContainer = null;
// The document
String docString = "D:/xmldata/test.xml";
// The document's name.
String docName = "cia";
try {
myManager = new XmlManager(); // Assumes the container currently exists.
myContainer =
myManager.createContainer("twoppro.bdbxml");
myManager.setDefaultContainerType(XmlContainer.NodeContainer); // Need an update context for the put.
XmlUpdateContext theContext = myManager.createUpdateContext(); // Get the input stream.
XmlInputStream theStream =
myManager.createLocalFileInputStream(docString); // Do the actual put
myContainer.putDocument(docName, // The document's name
theStream, // The actual document.
theContext, // The update context
// (required).
null); // XmlDocumentConfig object
theStream.delete();
// Update the title
String STATEMENT1 = "for $n in collection('twoppro.bdbxml')/Bookstore/Book[book_ID=1]/title return replace value of node $n with 'NEWBOOK'";
XmlQueryContext context = myManager.createQueryContext();
XmlQueryExpression queryExpression1 = myManager.prepare(STATEMENT1, context);
System.out.println("Done query: " + STATEMENT1);
queryExpression1.execute(context);
// Get a query context
XmlQueryContext thiscontext = myManager.createQueryContext();
// Set the evaluation type to Lazy.
context.setEvaluationType(XmlQueryContext.Lazy);
// Declare the query string
String queryString =
"for $u in collection('twoppro.dbxml')/Bookstore/Book/[bookid=1]"
+ "return $u/title";
// Prepare (compile) the query
XmlQueryExpression qe = myManager.prepare(queryString, thiscontext);
XmlResults results = qe.execute(thiscontext);
System.out.println("ok");
System.out.println(results);
} catch (XmlException e) {
// Error handling goes here. You may want to check
// for XmlException.UNIQUE_ERROR, which is raised
// if a document with that name already exists in
// the container. If this exception is thrown,
// try the put again with a different name, or
// use XmlModify to update the document.
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
try {
if (myContainer != null) {
myContainer.close();
if (myManager != null) {
myManager.close();
} catch (XmlException ce) {
// Exception handling goes here
Thanks. -
Help with if statement in cursor and for loop to get output
I have the following cursor and and want to use if else statement to get the output. The cursor is working fine. What i need help with is how to use and if else statement to only get the folderrsn that have not been updated in the last 30 days. If you look at the talbe below my select statement is showing folderrs 291631 was updated only 4 days ago and folderrsn 322160 was also updated 4 days ago.
I do not want these two to appear in my result set. So i need to use if else so that my result only shows all folderrsn that havenot been updated in the last 30 days.
Here is my cursor:
/*Cursor for Email procedure. It is working Shows userid and the string
You need to update these folders*/
DECLARE
a_user varchar2(200) := null;
v_assigneduser varchar2(20);
v_folderrsn varchar2(200);
v_emailaddress varchar2(60);
v_subject varchar2(200);
Cursor c IS
SELECT assigneduser, vu.emailaddress, f.folderrsn, trunc(f.indate) AS "IN DATE",
MAX (trunc(fpa.attemptdate)) AS "LAST UPDATE",
trunc(sysdate) - MAX (trunc(fpa.attemptdate)) AS "DAYS PAST"
--MAX (TRUNC (fpa.attemptdate)) - TRUNC (f.indate) AS "NUMBER OF DAYS"
FROM folder f, folderprocess fp, validuser vu, folderprocessattempt fpa
WHERE f.foldertype = 'HJ'
AND f.statuscode NOT IN (20, 40)
AND f.folderrsn = fp.folderrsn
AND fp.processrsn = fpa.processrsn
AND vu.userid = fp.assigneduser
AND vu.statuscode = 1
GROUP BY assigneduser, vu.emailaddress, f.folderrsn, f.indate
ORDER BY fp.assigneduser;
BEGIN
FOR c1 IN c LOOP
IF (c1.assigneduser = v_assigneduser) THEN
dbms_output.put_line(' ' || c1.folderrsn);
else
dbms_output.put(c1.assigneduser ||': ' || 'Overdue Folders:You need to update these folders: Folderrsn: '||c1.folderrsn);
END IF;
a_user := c1.assigneduser;
v_assigneduser := c1.assigneduser;
v_folderrsn := c1.folderrsn;
v_emailaddress := c1.emailaddress;
v_subject := 'Subject: Project for';
END LOOP;
END;
The reason I have included the folowing table is that I want you to see the output from the select statement. that way you can help me do the if statement in the above cursor so that the result will look like this:
emailaddress
Subject: 'Project for ' || V_email || 'not updated in the last 30 days'
v_folderrsn
v_folderrsn
etc
[email protected]......
Subject: 'Project for: ' Jim...'not updated in the last 30 days'
284087
292709
[email protected].....
Subject: 'Project for: ' Kim...'not updated in the last 30 days'
185083
190121
190132
190133
190159
190237
284109
286647
294631
322922
[email protected]....
Subject: 'Project for: Joe...'not updated in the last 30 days'
183332
183336
[email protected]......
Subject: 'Project for: Sam...'not updated in the last 30 days'
183876
183877
183879
183880
183881
183882
183883
183884
183886
183887
183888
This table is to shwo you the select statement output. I want to eliminnate the two days that that are less than 30 days since the last update in the last column.
Assigneduser....Email.........Folderrsn...........indate.............maxattemptdate...days past since last update
JIM......... jim@ aol.com.... 284087............. 9/28/2006.......10/5/2006...........690
JIM......... jim@ aol.com.... 292709............. 3/20/2007.......3/28/2007............516
KIM......... kim@ aol.com.... 185083............. 8/31/2004.......2/9/2006............. 928
KIM...........kim@ aol.com.... 190121............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190132............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190133............. 2/9/2006.........2/9/2006.............928
KIM...........kim@ aol.com.... 190159............. 2/13/2006.......2/14/2006............923
KIM...........kim@ aol.com.... 190237............. 2/23/2006.......2/23/2006............914
KIM...........kim@ aol.com.... 284109............. 9/28/2006.......9/28/2006............697
KIM...........kim@ aol.com.... 286647............. 11/7/2006.......12/5/2006............629
KIM...........kim@ aol.com.... 294631............. 4/2/2007.........3/4/2008.............174
KIM...........kim@ aol.com.... 322922............. 7/29/2008.......7/29/2008............27
JOE...........joe@ aol.com.... 183332............. 1/28/2004.......4/23/2004............1585
JOE...........joe@ aol.com.... 183336............. 1/28/2004.......3/9/2004.............1630
SAM...........sam@ aol.com....183876.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183877.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183879.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183880.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183881.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183882.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183883.............3/5/2004.........3/8/2004.............1631
SAM...........sam@ aol.com....183884.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183886.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183887.............3/5/2004.........3/8/2004............ 1631
SAM...........sam@ aol.com....183888.............3/5/2004.........3/8/2004............ 1631
PAT...........pat@ aol.com.....291630.............2/23/2007.......7/8/2008............ 48
PAT...........pat@ aol.com.....313990.............2/27/2008.......7/28/2008............28
NED...........ned@ aol.com.....190681.............4/4/2006........8/10/2006............746
NED...........ned@ aol.com......95467.............6/14/2006.......11/6/2006............658
NED...........ned@ aol.com......286688.............11/8/2006.......10/3/2007............327
NED...........ned@ aol.com.....291631.............2/23/2007.......8/21/2008............4
NED...........ned@ aol.com.....292111.............3/7/2007.........2/26/2008............181
NED...........ned@ aol.com.....292410.............3/15/2007.......7/22/2008............34
NED...........ned@ aol.com.....299410.............6/27/2007.......2/27/2008............180
NED...........ned@ aol.com.....303790.............9/19/2007.......9/19/2007............341
NED...........ned@ aol.com.....304268.............9/24/2007.......3/3/2008............ 175
NED...........ned@ aol.com.....308228.............12/6/2007.......12/6/2007............263
NED...........ned@ aol.com.....316689.............3/19/2008.......3/19/2008............159
NED...........ned@ aol.com.....316789.............3/20/2008.......3/20/2008............158
NED...........ned@ aol.com.....317528.............3/25/2008.......3/25/2008............153
NED...........ned@ aol.com.....321476.............6/4/2008.........6/17/2008............69
NED...........ned@ aol.com.....322160.............7/3/2008.........8/21/2008............4
MOE...........moe@ aol.com.....184169.............4/5/2004.......12/5/2006............629
[email protected]/27/2004.......3/8/2004............1631
How do I incorporate a if else statement in the above cursor so the two days less than 30 days since last update are not returned. I do not want to send email if the project have been updated within the last 30 days.
Edited by: user4653174 on Aug 25, 2008 2:40 PManalytical functions: http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/functions2a.htm#81409
CASE
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/02_funds.htm#36899
http://download.oracle.com/docs/cd/B10501_01/appdev.920/a96624/04_struc.htm#5997
Incorporating either of these into your query should assist you in returning the desired results. -
Hi, i have the following data
document_seq_num, Country, LE, SOB
33100037 NL 000320 13
33100037 NL 000320 13
33100037 NL 000320 13
33100037 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
i want an update statement for every change in the document sequnce with the other combination..
the seqence number should change.
i tried to write a rank over partion and and sequence but when i am trying to update, this is always updating
90000000 in first run, as it is in loop for all records it is updating the same. i want an
increment to the sequence for every change in document_seq_num
Can any one help me to correct this procedure
create or replace PROCEDURE test is
cursor cur_voc_ref
IS SELECT a.document_seq_num,
a.country, a.LE, a.SOB, 2009, Rank() over (partition by
a.country, a.LE, a.SOB
order by a.document_seq_num, a.country, a.LE, a.SOB)
from (select distinct document_seq_num,
country, LE, SOB,period_name
from temp_tab
where country= 'NL'
and LE= '000320'
and SOB=13
order by SOB,LE,document_seq_num) a
where
a.country= 'NL'
and a.LE= '000320'
and a.SOB=13
and substr(a.period_name,5,6) =substr(2009,3,4);
v_base number;
BEGIN
FOR c_rec IN cur_voc_ref
LOOP
BEGIN
select nvl(max(ggtsi.reference), substr(2009,3,2)*1000000) into v_base
from temp_tab ggtsi;
update temp_tab
set reference= v_base
where document_seq_num= c_rec.document_seq_num
and country=c_rec.country
and le=c_rec.le
and sob=c_rec.sob;
commit;
END;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line( 'Exception in opening balance insert ' || SQLCODE || ' ' || SQLERRM );
END;user11289444 wrote:
Hi, i have the following data
document_seq_num, Country, LE, SOB
33100037 NL 000320 13
33100037 NL 000320 13
33100037 NL 000320 13
33100037 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100038 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100039 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100040 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100041 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100042 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
33100043 NL 000320 13
i want an update statement for every change in the document sequnce with the other combination..
the seqence number should change.
i tried to write a rank over partion and and sequence but when i am trying to update, this is always updating
90000000 in first run, as it is in loop for all records it is updating the same. i want an
increment to the sequence for every change in document_seq_num
Can any one help me to correct this procedure
create or replace PROCEDURE test is
cursor cur_voc_ref
IS SELECT a.document_seq_num,
a.country, a.LE, a.SOB, 2009, Rank() over (partition by
a.country, a.LE, a.SOB
order by a.document_seq_num, a.country, a.LE, a.SOB)
from (select distinct document_seq_num,
country, LE, SOB,period_name
from temp_tab
where country= 'NL'
and LE= '000320'
and SOB=13
order by SOB,LE,document_seq_num) a
where
a.country= 'NL'
and a.LE= '000320'
and a.SOB=13
and substr(a.period_name,5,6) =substr(2009,3,4);
v_base number;
BEGIN
FOR c_rec IN cur_voc_ref
LOOP
BEGIN
select nvl(max(ggtsi.reference), substr(2009,3,2)*1000000) into v_base
from temp_tab ggtsi;
update temp_tab
set reference= v_base
where document_seq_num= c_rec.document_seq_num
and country=c_rec.country
and le=c_rec.le
and sob=c_rec.sob;
commit;
END;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line( 'Exception in opening balance insert ' || SQLCODE || ' ' || SQLERRM );
END;Hi,
I suggest you to add a column to preserve current RANK value for all rows, <preserve_rank> for example, and
when you add the new rows you will update your <preserve_rank> but you must pay attention to have the same value for
document_seq_num, with other words you may insert yours rows in a batch like this:
-- first update preserve_rank with RANK function
declare
v_doc_seq_num numeric;
begin
v_doc_seq_num:=33100040;
-- note !!!
-- put all into a valid sql command
-- and apply execute immediate
insert into temp_tab(document_seq_num, country, le, sob,Period_name)values(v_doc_seq_num, 'NL', '000320', 13,'APR-09');
insert into temp_tab(document_seq_num, country, le, sob,Period_name)values(v_doc_seq_num, 'NL', '000320', 13,'APR-09');
insert into temp_tab(document_seq_num, country, le, sob,Period_name)values(v_doc_seq_num, 'NL', '000320', 13,'APR-09');
-- update preserve_rank
update temp_tab x set x.preserve_rank = (Select max(preserve_rank) from temp_tab y
where y.document_seq_num=v_doc_seq_num) old_rank + 1)
where (prserve_rank is null) and x.document_seq_num=v_doc_seq_num;
end; I know it's a lost a memory but the trigger is the last solution who can give us a nightmare.
Regards,
Ion
Edited by: user111444777 on Sep 25, 2009 11:12 AM
Edited by: user111444777 on Sep 25, 2009 11:35 AM -
Emergency: problem with update statement!
hello guys, i have a very serious problem with an update statement in pl/sql.
i had an application written in sybase, where i had the following update statement:
update mis_dik_adeia
set trexon_etos_days = days_per_year
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_dik_adeia.adeia_id between :aapo and :aews
and mis_dik_adeia.employee_id = :erg
and mis_dik_adeia.etos = :etos
and mis_plafon_adeivn.years_yphr = ( select max( a.years_yphr ) from mis_plafon_adeivn a where a.adeia_id = mis_plafon_adeivn.adeia_id and a.years_yphr <= :eth ) using sqlca;
This is working properly in sybase. When i copied this code in pl/sql it displayed me error and it's impossible to work. Then i thought to make a nested select statement like this:
update mis_dik_adeia
set trexon_etos_days = (select days_per_year
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and mis_plafon_adeivn.years_yphr = (
select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth )
but as you can understand, it is working, but it doesn't produce the same results as the update statement in Sybase!
It is very important for me to solve this problem , which is a very big trouble for me for a long time.
Please if anyone can help me i would appreciate it a lot!
Regards ,
Bill...Bill,
folowing the logic of your original query by Sybase
(it's embedded SQL in Power Builder, isn't it ?):
update mis_dik_adeia
set trexon_etos_days = (select days_per_year
from mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_plafon_adeivn.years_yphr = (
select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth )
where
mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and
exists (select 1
from mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
and mis_plafon_adeivn.years_yphr = (
select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth )
In 9i you can also try the following:
megre into mis_dik_adeia
using (
select
days_per_year,
mis_dik_adeia.rowid rid
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and mis_plafon_adeivn.years_yphr =
(select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth)
) src
on (mis_dik_adeia.rowid = src.rid)
when matched then
update set mis_dik_adeia.trexon_etos_days = src.days_per_year
when not matched then
insert (mis_dik_adeia.adeia_id) values(0);
In 10G it can be easily:
megre into mis_dik_adeia
using (
select
days_per_year,
mis_dik_adeia.rowid rid
from mis_dik_adeia, mis_plafon_adeivn
where mis_dik_adeia.adeia_id = mis_plafon_adeivn.adeia_id
mis_dik_adeia.adeia_id between aapo and aews
and mis_dik_adeia.employee_id = erg
and mis_dik_adeia.etos = etos1
and mis_plafon_adeivn.years_yphr =
(select max( a.years_yphr )
from mis_plafon_adeivn a
where a.adeia_id = mis_plafon_adeivn.adeia_id
and a.years_yphr <= eth)
) src
on (mis_dik_adeia.rowid = src.rid)
when matched then
update set mis_dik_adeia.trexon_etos_days = src.days_per_year;
I have to notice I didn't check it carefully, so I can miss...
Rgds.
Corrected a mistake in the table name
Message was edited by:
dnikiforov -
Hi friends,
In the below am trying to update a custom table using a call function in update task. I dont see the table getting updated can someone take a look at it and let me knw what the problem is? I have the commit work statement and also marked the function module as an update one in the attribute. Please help me . Thanks in advance! kathy
*& Include ZINBOUND_TEST
Report: ZINBOUND_TEST.
DATA: l_dest TYPE REF TO if_bgrfc_destination_inbound,
l_unit TYPE REF TO if_trfc_unit_inbound,
l_inb_dest TYPE bgrfc_main_i_dst,
lv_matid TYPE /sapapo/matid,
lv_matnr TYPE /sapapo/matnr,
lv_maktx type /SAPAPO/MAKTX,
lv_langu TYPE LANGU.
data: lt_product type STANDARD TABLE OF ZUPDATE,
ls_product type ZUPDATE.
lv_matid = '123'.
lv_langu = 'E'.
lv_maktx = 'Materia1'.
CALL FUNCTION 'Z_TEST' IN UPDATE TASK
EXPORTING
iv_matid = lv_matid
iv_maktx = lv_maktx
iv_langu = lv_langu .
COMMIT WORK.
select * from zupdate into corresponding fields OF TABLE lt_product.
if sy-subrc <> 0.
write 'no records added'.
else.
loop at lt_product into ls_product.
write: / ls_product-MATID,
ls_product-MAKTX.
endloop.
endif.
FUNCTION Z_TEST.
*"*"Update Function Module:
*"*"Local Interface:
*" IMPORTING
*" VALUE(IV_MATID) TYPE /SAPAPO/MATID
*" VALUE(IV_MAKTX) TYPE /SAPAPO/MAKTX
*" VALUE(IV_LANGU) TYPE LANGU
data: itab type standard table of zupdate,
wa_itab type zupdate.
wa_itab-matid = iv_matid.
wa_itab-maktx = iv_maktx.
wa_itab-langu = iv_langu.
append wa_itab to itab.
update zupdate from table itab .
ENDFUNCTION.
Edited by: ka reddy on Sep 24, 2009 4:14 PM
Edited by: ka reddy on Sep 24, 2009 4:15 PM
Edited by: ka reddy on Sep 24, 2009 4:16 PM
Edited by: ka reddy on Sep 24, 2009 4:17 PM
Edited by: ka reddy on Sep 24, 2009 4:21 PMHey Naimesh thanks for the reply. yeah i read that document way before and i started taking a stab at implementing it.
I started with update task to see how it behaves and then wanted to go with BGRFC tats when i had the update issue.
Now that am done with update i want to implement BGRFC.
I have modified the earlier prgm...Can you give me some ideas how to extend this? Thanks!
*& Include ZBGRFC_INBOUND_TEST
Report: ZBGRFC_INBOUND_TEST.
DATA: l_dest TYPE REF TO if_bgrfc_destination_inbound,
l_unit TYPE REF TO if_trfc_unit_inbound,
l_inb_dest TYPE bgrfc_main_i_dst,
lv_matid TYPE /sapapo/matid,
lv_matnr TYPE /sapapo/matnr,
lv_maktx type /SAPAPO/MAKTX,
lv_matid1 TYPE /sapapo/matid,
lv_matnr1 TYPE /sapapo/matnr,
lv_maktx1 type /SAPAPO/MAKTX,
lv_langu1 TYPE LANGU,
lv_langu TYPE LANGU.
data: lt_product type STANDARD TABLE OF ZUPDATE,
ls_product type ZUPDATE.
lv_matid = '125'.
lv_langu = 'E'.
lv_maktx = 'Materia3'.
**--Get the inbound destination for BGRFC.
IF l_inb_dest IS INITIAL.
SELECT SINGLE * FROM bgrfc_main_i_dst INTO l_inb_dest.
ENDIF.
l_dest = cl_bgrfc_destination_inbound=>create( l_inb_dest-destination ).
l_unit = l_dest->create_trfc_unit( ).
CALL FUNCTION 'Z_TEST' IN BACKGROUND UNIT l_unit
EXPORTING
iv_matid = lv_matid
iv_maktx = lv_maktx
iv_langu = lv_langu .
select * from zupdate into corresponding fields OF TABLE lt_product.
if sy-subrc <> 0.
write 'no records added'.
else.
loop at lt_product into ls_product.
write: / ls_product-MATID,
ls_product-MAKTX.
endloop.
endif.
Edited by: ka reddy on Sep 24, 2009 5:16 PM -
Need a help on Update statement
Hi All,
I Need a help in updating a table column. PFB my requirement.
Table1
ItemID OrgId Date
1 82 12/sep/2012
2 82 25/oct/2012
3 82 17/Nov/2012
4 82 22/Jan/2013
5 82 26/sep/2012
Table2
Itemid orgid Date1
1 82 23/sep/2012
2 82 25/Dec/2012
3 82 17/Sep/2012
4 82 22/Feb/2013
5 82 26/Oct/2012
Table3
Itemid orgid Date3
1 82 10/sep/2012
7 82 30/Dec/2012
3 82 12/Sep/2012
10 82 27/Feb/2013
5 82 29/Oct/2012
I Need to Update Date column of Table1 With Date3 of table3
If
Item and org combination is present in table3 and date column of table1 is less than Date3 of table3
Else
I need to Update with date2 of table2.Can we acheive this in a single update statement, can any one help me on this.
Thanks and regards,
Rakesh
Edited by: Venkat Rakesh on Sep 27, 2012 11:04 PMYou can probably also use MERGE:
--DROP TABLE table1;
--DROP TABLE table2;
--DROP TABLE table3;
ALTER SESSION SET nls_language = 'AMERICAN';
CREATE TABLE table1
itemid CHAR (1),
orgid CHAR (2),
thedate DATE
INSERT INTO table1 SELECT '1', '82', TO_DATE ('10/sep/2011', 'dd/mon/yyyy') FROM DUAL;
INSERT INTO table1 SELECT '2', '82', TO_DATE ('10/oct/2011', 'dd/mon/yyyy') FROM DUAL;
INSERT INTO table1 SELECT '3', '82', TO_DATE ('10/nov/2011', 'dd/mon/yyyy') FROM DUAL;
INSERT INTO table1 SELECT '4', '82', TO_DATE ('10/jan/2011', 'dd/mon/yyyy') FROM DUAL;
INSERT INTO table1 SELECT '5', '82', TO_DATE ('10/sep/2011', 'dd/mon/yyyy') FROM DUAL;-- won't be updated
CREATE TABLE table2
itemid CHAR (1),
orgid CHAR (2),
thedate DATE
INSERT INTO table2 SELECT '1', '82', TO_DATE ('01/sep/2012', 'dd/mon/yyyy') FROM DUAL;
INSERT INTO table2 SELECT '2', '82', TO_DATE ('01/dec/2012', 'dd/mon/yyyy') FROM DUAL;
INSERT INTO table2 SELECT '3', '82', TO_DATE ('01/sep/2012', 'dd/mon/yyyy') FROM DUAL;
INSERT INTO table2 SELECT '4', '82', TO_DATE ('01/feb/2012', 'dd/mon/yyyy') FROM DUAL;
CREATE TABLE table3
itemid CHAR (1),
orgid CHAR (2),
thedate DATE
INSERT INTO table3 SELECT '2', '82', TO_DATE ('30/dec/2009', 'dd/mon/yyyy') FROM DUAL; -- date less than table1, so picks from table2
INSERT INTO table3 SELECT '4', '82', TO_DATE ('30/mar/2013', 'dd/mon/yyyy') FROM DUAL; -- larger than table1 , so pick this date
-- table1 original data
SELECT * FROM table1;
-- merge new data
MERGE INTO table1
USING (SELECT NVL (t1.itemid, t2.itemid) itemid,
NVL (t1.orgid, t2.orgid) orgid,
t2.thedate prefdate ,
t1.thedate nextdate
FROM table2 t1
FULL OUTER JOIN
table3 t2
ON t1.itemid = t2.itemid AND t1.orgid = t2.orgid) dat
ON (dat.itemid = table1.itemid AND dat.orgid = table1.orgid)
WHEN MATCHED
THEN
UPDATE SET table1.thedate = (case when prefdate > table1.thedate then prefdate else nextdate end) ;
--table1 updated data
SELECT * FROM table1;OUTPUT:
Session altered.
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
1 row created.
Table created.
1 row created.
1 row created.
1 row created.
1 row created.
Table created.
1 row created.
1 row created.
ITEMID ORGID THEDATE
1 82 10.09.2011
2 82 10.10.2011
3 82 10.11.2011
4 82 10.01.2011
5 82 10.09.2011
5 rows selected.
4 rows merged.
ITEMID ORGID THEDATE
1 82 01.09.2012
2 82 01.12.2012
3 82 01.09.2012
4 82 30.03.2013
5 82 10.09.2011
5 rows selected. -
Hi, Please help me on the following update scenario
I have a column in a table PRD_NM which is a not null column.. I want to update this column with a set of values from another query..
UPDATE Table1 tg
set PRD_NM=(select PRD_NM from( select prd_nm,state,item_no,bar_code from products) sr
where tg.state=sr.state and tg.item_no=sr.item_no and tg.bar_code=sr.bar_code
and tg.PRD_NM='NA')
basically i want to update all those PRD_NM with value 'NA' to the value coming from the source query...
but when I run the statement I am getting an error saying that the PRD_NM cannot be set to null... But here I am not considering anything that can be a null when updated.
Please help with any idea...
Edited by: user626688 on Jan 21, 2009 11:18 AMHi,
If you can't UPDATE via an in-line view (as Someoneelse suggested), and you don't want to basically do the same query twice (once in the scalar sub-query, then again in an EXISTS subquery, as in Someoneelse's next to last message), you can use MERGE:
MERGE INTO Table1 tg
USING ( SELECT prd_nm, state, item_no, bar_code
FROM products
) sr
ON ( tg.state = sr.state
AND tg.item_no = sr.item_no
AND tg.bar_code = sr.bar_code
AND tg.PRD_NM = 'NA'
WHEN MATCHED THEN
UPDATE SET tg.prd_nm = sr.prd_nm;Without copies of your tables and data, I can't test. -
Hi,
First Special thanks to Kglad for the help with the AS1 to AS3 conversion.
I've been able to link up my buttons to play a different frames of the movie. this was my novice way of finally getting the programming to work.
In frame 95 I have
var myLoader:Loader = new Loader();
addChild(myLoader); var url:URLRequest = new URLRequest("page1.swf");
myLoader.load(url);
in frame 165:
var myLoader1:Loader = new Loader();
addChild(myLoader1); var url1:URLRequest = new URLRequest("page1.swf");
myLoader1.load(url1);
My buttons link to 116 which plays a frame and loads ^
in frame 226: removeChild(myLoader).
But if the user has looped back into home from another part in the movie clip then it would need to remove myLoader1 instead of myLoader.
I'm guessing there is some really dynamic way to solve the programatic nightmare i'm developing, but I'm really novice.
So what i need is an if statement for frame 226
That would do something:
if(myLoader <> null
removeChild(myLoader)
else(
removechild(myLoader1)
Anyone have a method for this?yes, you can use the same urlrequest but just change its url property:
// initialize, for example in frame 1. this is done once and never again:
var loader:Loader=new Loader();
var urlR:URLRequest=new URLRequest();
// then in frame 2, for example:
urlR.url="page1.swf";
loader.load(urlR);
// in frame 20, for example:
urlR.url="page2.swf";
loader.load(urlR);
// in frame 30, for example:
urlR.url="page3.swf";
loader.load(urlR);
//etc. if you're loading any swfs that play streams (sound or video), you'll want to add some code to this. -
Help with Switch statements using Enums?
Hello, i need help with writing switch statements involving enums. Researched a lot but still cant find desired answer so going to ask here. Ok i'll cut story short.
Im writing a calculator program. The main problem is writing code for controlling the engine of calculator which sequences of sum actions.
I have enum class on itself. Atm i think thats ok. I have another class - the engine which does the work.
I planned to have a switch statement which takes in parameter of a string n. This string n is received from the user interface when users press a button say; "1 + 2 = " which each time n should be "1", "+", "2" and "=" respectively.
My algorithm would be as follows checking if its a operator(+) a case carry out adding etc.. each case producing its own task. ( I know i can do it with many simple if..else but that is bad programming technique hence im not going down that route) So here the problem arises - i cant get the switch to successfully complete its task... How about look at my code to understand it better.
I have posted below all the relevant code i got so far, not including the swing codes because they are not needed here...
ValidOperators v;
public Calculator_Engine(ValidOperators v){
stack = new Stack(20);
//The creation of the stack...
this.v = v;
public void main_Engine(String n){
ValidOperators v = ValidOperators.numbers;
*vo = vo.valueOf(n);*
switch(v){
case Add: add(); break;
case Sub: sub(); break;
case Mul: Mul(); break;
case Div: Div(); break;
case Eq:sum = stack.sPop(); System.out.println("Sum= " + sum);
default: double number = Integer.parseInt(n);
numberPressed(number);
break;
//default meaning its number so pass it to a method to do a job
public enum ValidOperators {
Add("+"), Sub("-"), Mul("X"), Div("/"),
Eq("="), Numbers("?"); }
Notes*
It gives out error: "No enum const class ValidOperators.+" when i press button +.
It has nothing to do with listeners as it highlighted the error is coming from the line:switch(v){
I think i know where the problem is.. the line "vo = vo.valueOf(n);"
This line gets the string and store the enum as that value instead of Add, Sub etc... So how would i solve the problem?
But.. I dont know how to fix it. ANy help would be good
Need more info please ask!
Thanks in advance.demo:
import java.util.*;
public class EnumExample {
enum E {
STAR("*"), HASH("#");
private String symbol;
private static Map<String, E> map = new HashMap<String, E>();
static {
put(STAR);
put(HASH);
public String getSymbol() {
return symbol;
private E(String symbol) {
this.symbol = symbol;
private static void put(E e) {
map.put(e.getSymbol(), e);
public static E parse(String symbol) {
return map.get(symbol);
public static void main(String[] args) {
System.out.println(E.valueOf("STAR")); //succeeds
System.out.println(E.parse("*")); //succeeds
System.out.println(E.parse("STAR")); //fails: null
System.out.println(E.valueOf("*")); //fails: IllegalArgumentException
}
Maybe you are looking for
-
My daughter has an ipod and I'm getting a second ipod. I have separate user accounts and want to have separate itunes but access the same library. I've read the "How to use multiple ipods with one computer" and "Itunes How to share music between diff
-
How to stop email notifications from this site??
I signed up here a while ago because I needed some help with software on my macbook. As it happens, ever since, I´ve been receiving approximatly one hundred email a day from this forum, general replies to peoples questions here. I have NOT signed up
-
Dear All, I have changed the PWD file on oracle 9.2.04 under linux redhat advance server 2.1. but when i start to open database by issuing dbstart, i get ORA-01990: Error opening password file '/home/oracle/OraHome1/dbs/orapw' ORA-27037: unable to ob
-
I am using a GPIB card to send a pulse to data logger to control a firing system
I need to be able to fire my linear accelerator from the computer, by sending a negative pulse and I need to be able to control the pulse duration, and also its voltage, I am using an HP34970A data logger with a HP34907A module.
-
Manual Changes in Provider.XML
Hi Experts, Mine is a File to XI to JDBC[SQL SERVER] scenerio. Certain JAR files were missing in the JDBC application, so I had to follow the PDF file: How To Installand Configure ExternalDrivers for the JDBC & JMS Adapters which instructed me to