help in writing a little code pl/sql
Hi allI want to write a script for example I 3 Colum let A, B, C documents are already in the database now, I want my script to check the values of Colum C must equal (A, B) as A - B = C if she even noting do with C another thing she updates C with the value of A - B please help
then you can make a little change with the rest of the code above.
create or replace procedure test asbegin for m in (select * from t) loop if m.C=m.A and m.C=m.B then null; else update t set C=m.A-m.B where id=m.id; end if; end loop;end;
Khurram
Tags: Database
Similar Questions
-
need help in writing a little java code
Hello
I have a small requirement where I need to write a java code small. I am using table. Please suggest if you know the solution:
1. the need to compare the id of user connection is preset in the table of correspondence or not.
2. If the id of the current user in the search then send, type 'A' mail
3. If the user id in not present in the search then send by email 'B' type.
Please suggest.
Thank you
Kalpana.Use this code. You must pass the name userlogin and research
Public String returned (String UserLogin, String lookupcode)
{
The chain e-mail;
try {}
tcLookupOperationIntf lookupIntf = (tcLookupOperationIntf.class) Platform.getService;
HashMaplookupValues = getLookupHashMap (lookupIntf, lookupCode);
Found string = lookupValues.get (UserLogin);
If (found! = null) email = ' EMAIL ';
on the other
email = 'EMAIL B ';.
} catch (Exception e) {}
return of electronic mail;
}private HashMap
getLookupHashMap (tcLookupOperationsIntf lookupOperationsIntf, String lookupCode) survey tcAPIException, tcInvalidLookupException, tcColumnNotFoundException {}
HashMaplookupMap = new HashMap () ; tcResultSet resultLookupHashMap = lookupOperationsIntf
.getLookupValues (lookupCode);
int countResultLookupHashMap = resultLookupHashMap.getRowCount ();
If (countResultLookupHashMap > 0) {}
for (int i = 0; i)< countresultlookuphashmap;="" i++)="">
resultLookupHashMap.goToRow (i);
lookupMap.put (resultLookupHashMap.. getStringValue ("Definition.Lookup Code Information.Code search key")
resultLookupHashMap.getStringValue ("search Definition.Lookup Code Information.Decode"));
}}
Return lookupMap;
} -
Pavilion G6 power on password forgotten by my friend, just trying to help him. stop the 66158175 code
Hello
Try to enter: 79830171
Kind regards
DP - K
-
Help me with WindowsUpdate_80070490 error code""WindowsUpdate_dt000"
Help me with WindowsUpdate_80070490 error code""WindowsUpdate_dt000"does that mean?
Please read: http://social.answers.microsoft.com/Forums/en-US/vistawu/thread/1467f44b-ee27-4f7d-98d7-f1c4b35b3395
What application or antivirus security suite is installed and your current subscription? What anti-spyware (other than Defender) applications? What third-party firewall (if applicable)?
A (another) Norton or McAfee application has already been installed on the computer (for example, a free trial version which is preinstalled when you bought it)?
You receive an error code "0 x 80070490" when you use Microsoft Update or Windows Update Web sites to install updates
http://support.Microsoft.com/kb/958044~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft
-
help me with this error code 80070005 Code...
help me with this error code 80070005 Code...
my windows is not updated for a few days...
Please help me...You don't have to know which operating system you use, this discussion is for Windows XP, etc. of Vista and Windows 7.
Error message when you use Microsoft Update or Windows Update Web sites to install updates on Windows 2000, Windows XP and Windows Server 2003: 0 x 80070005
http://support.Microsoft.com/kb/968003/If you are using Vista, then the denied access is handled differently-
Error code 0 x 80070005 is also described as ACCESS DENIED (you may not to install updates.
Please check that you are logged into an account with administrative privileges.
Please follow these instructions if you encounter this error code during checking or install updates via Windows Udpate. What follows applies only to Windows Vista.
2. save the zip on your desktop and extract the file:
-Right-click on the file and select extract all...
-Click Next when prompted for the Destination.Therefore, you should see a folder called AccessChk on your desktop.
3. open the folder AccessChk
4 press and hold the shift key and right-click in the window. Select "open here command prompt.
5. a command prompt window should open a similar message:
C:\Users\\Desktop\accesschk > 6. type the following command and press ENTER:
"" AccessChk.exe "nt service TrustedInstaller" s - n k ' hklm\software\Microsoft\Windows\CurrentVersion\Component Based Servicing "> accesskchk.txt
Tip: You should be able to copy and paste the command into the command prompt.7. close the command prompt window. Open the Accesschk folder on your desktop (if it has been closed).
8. double-click on Accesschk.txt (text file), it should open Notepad.
If this is insufficient,
1 if please download the subinacl.msi from the following link and save the patch to installation on the desktop:
http://www.Microsoft.com/downloads/details.aspx?FamilyId=e8ba3e56-d8fe-4A91-93Cf-ed6985e3927b&displaylang=en#AffinityDownloads
SubInACL (SubInACL.exe)
2. go to your desktop and double-click on the downloaded file.
3. Please select the C:\Windows\System32 folder as the Destination folder during installation. Later, we will use this tool to reset the permissions on the current computer settings.
4. click on the button 'Start' in the 'Search' bar type: "Notepad" (without the quotes) and press ENTER.
5. copy the following commands, and then paste them into the opened Notepad window:
off @echo
Subinacl /subkeyreg HKEY_LOCAL_MACHINE/Grant = administrators = f
Subinacl /subkeyreg HKEY_CURRENT_USER/Grant = administrators = f
Subinacl /subkeyreg HKEY_CLASSES_ROOT/Grant = administrators = f
Subinacl % lecteur_systeme % /subdirectories / Grant = administrators = f
Subinacl /subkeyreg HKEY_LOCAL_MACHINE/Grant = system = f
Subinacl /subkeyreg HKEY_CURRENT_USER/Grant = system = f
Subinacl /subkeyreg HKEY_CLASSES_ROOT/Grant = system = f
Subinacl % lecteur_systeme % /subdirectories / Grant = system = f
@Echo =========================
Completed @Echo.
@Echo =========================
@pause
6. After you paste the above commands, please close the Notepad window. Choose "Save" when you are prompted to save the file. Type "reset.bat" as the file name and choose "Desktop" in the Panel on the left as the save location.7. refer to the desktop and right click the reset.bat file, then choose "Run as Administrator".
8. you will see a window of type BACK treatment.
NOTE: It may take several minutes, please be patient. When it is finished, you will be prompted with the message: "finished, press any key to continue."Note: On some driver update installation procedure, we also received this error code, please redirect this kind of case to the Team System Vista, because it can be considered for structure of third-party programs.
Look for updates after that.
Hope this information is useful.
This problem may be caused by third-party security programs such as firewalls and antivirus software. You can disable or remove to check the issue.
From: Microsoft Answers Support Engineer
TaurArian [MVP] 2005-2010 - Update Services
-
Please help KB 976370-Upgrade error code-80073701
Please help KB 976370-Upgrade error code-80073701
Windows Update Forum:
It comes with Vista, upgrade install and activate Forum.
You will get the best help for any problem of Update/Service Pack in the Windows Update Forum; the link below:
http://social.answers.Microsoft.com/forums/en-us/vistawu/threads
When you repost here, kindly include the Error Codes, and exactly what is happening when you try to update.
In this way, you will receive the best help.
See you soon.
Mick Murphy - Microsoft partner
-
I have a problem check my code for Lightroom 6 help please, the site says code cannot be verified. I have an existing application of Lightroom 2 and I paid for the upgrade
If you purchased the version of LR 6 upgrade then when you install and run for the first time it asks you to Sign In. You must sign in with the same Adobe ID you used to buy it. Then once it's a window will appear asking for a serial number. In this window, you enter the serial number LR 6 What adobe sent you. Then once that went into a second serial number box will appear asking for a serial number from a previous version. Then you enter the serial number LR 2. Series LR 2 will begin with the same 4 numbers, 1160.
-
Clouds (can someone help me with the error code 214?)
can someone help me with the error code 214?
Hello
Reference:--
Error in downloading, installing or updating Adobe Creative Cloud applications
-
I just downloaded the new DC Acrobat, and I'm having a lot of problems with it. It's very, very slow. He has opening, saving, closing, do anything. Is there something that can be done to help him run a little more, well, normally?
I fixed it! I used the string analyze function waiting in the Task Manager while opening a PDF file and have to wait 12 seconds... and it showed that the wait chain has been blocked by the Speech SDK. So I went to my Plugins of PDF from Adobe folder, which in my case is C:\Program Files (x 86) \Adobe\Acrobat DC\Acrobat\plug_ins and delete the plugin ReadOutLoud.api. (I had to close all instances of Acrobat DC first, and I had to also click the UAC Popup Windows application approval raised to remove the plugin) Now... instant Adobe Acrobat DC charge!
-
When I run the SQL below, I get the following:
08:00:08 [SELECT - 0 row (s), dry 0.000] [error Code: 904, SQL State: 42000] ORA-00904: "G". "" NAME ": invalid identifier
When I comment the lines "BOLD", it works fine. I tried to fully qualify the column without success. I'm sure it's a matter of formatting.
************************************************
Select
SR. SCHOOLID,
SR. StudentID, sr.coursenumber,
SR. REGISTREQ_ID,
(select
min (rr.ID |) » -'|| URI COURSEGROUP)
Of
REGISTREQ rr
where
RR.grade_level = (select s.sched_nextyeargrade from student s where s.id = sr.studentid)
and rr.yearid = 2100
and rr.id not in (6426,6415)
and rr. COURSEGROUP in
(select
g.Name
Of
g GEN
where
g.CAT = "coursegroups".
and instr (g.valuet, sr.coursenumber) > 0
and g.schoolid = sr.schoolid)
and ((g.name as 'ALT %' and sr. GLOBALALTERNATECOURSE = 1)
or (g.name not as 'ALT %' and sr. GLOBALALTERNATECOURSE = 0))
) as New_RegID
Of
SCHEDULEREQUESTS sr
where
SR. SCHOOLID = 703
and sr.yearid = 2100This is because the lines that you have Ringing are out of reach for the alias 'g', which is part of the inner query.
Maybe you want to just 'name' without the prefix "g.".
-
How to return an error code of SQL * Plus of PL/SQL procedure
Hello
I want to be able to pass a variable back to the Unix script, and I have the following code
******************
sqlplus/myuser mypass < < EOF
WHENEVER SQLERROR EXIT 41.
WHENEVER OSERROR EXIT 81;
execute pkonp.run_onp;
output
EXPRESSIONS OF FOLKLORE
ERRORCODE = $?
If [$ERRORCODE! = 0] #test for successful onp
then
#Notify failure of the administrator of the ONP.
echo 'Fail ONP to 'date' \n'
FI
******************
However, I am unable to get my PL/SQL to pass an error code to SQL * more.
How to catch an error in PL/SQL and pass the SQL error code *, so that SQL * Plus can then pass the error to the Unix Shell script?
Thank you very much.Yes - in a nut shell, you need to convert Oracle codes exception to the process of Linux/Unix/Windows exit codes as the number of exception Oracle is physically too large to fit into an integer to a byte that is used by the operating system for the exit codes.
The best place to do this would be something like a SQL * more script as is the process real o/s which should only return exit code of the kernel.
-
Need help in writing the SQL CASE or DECODE statement
Hi experts,
I need to write a SQL select order_num, cntry_cde, prod_id and Qty by joining order_num on PROD_ORDER and PROD_ORDER_TXT.
Here is my sample data
PROD ORDER_
order_num Prod_id Qty cntry_cde
100 US A1 5
101 US 10 A2
102 IN A3 4
103 TO THE A4 9
104. IN A5 3
PROD ORDER_TXT_
cntry_cde Prod_id order_num
100 US A1
101 US A2
102 NZ A3
103 TO THE A4
A5 104
Here's the requirement,
(1) if the cntry_cde in PROD_ORDER is the same as cntry_cde in PROD_ORDER_TXT then select PROD_ORDER.cntry_cde (orders 100, 101, 103)
(2) if they are different, choose PROD_ORDER_TXT (order 102, to THE NZ <>) country code
(3) if they are different and PROD_ORDER_TXT.cntry_cde is null, I can't use it like cntry_cde in my report (order 104). It happenend just because of bad data to the source.
I can't avoid it. Then just use the cntry_cde of PROD_ORDER
Expected results
100 US A1 5
101 US 10 A2
102 NZ A3 4 - changed in NZ
103 TO THE A4 9
104. IN A5 3 - IN retained as PROD_ORDER_TXT.cntry_cde is null
instructions for creation and insertion of sample table are lower than
create the table prod_order
(number of order_num,
cntry_cde CHAR (2),
prod_id VARCHAR2 (6).
number of quantity)
create the table prod_order_txt
(number of order_num,
cntry_cde CHAR (2),
prod_id VARCHAR2 (6))
insert into prod_order values (100, 'WE', 'A1', 5);
insert into prod_order values (101, 'WE', 'A2', 1);
insert into prod_order values (102, ' to THE ', 'A3', 4);
insert into prod_order values (103, ' to THE ', 'A4', 9);
insert into prod_order values (104, 'IN', 'A5', 3);
insert into prod_order_txt values (100, 'WE', 'A1');
insert into prod_order_txt values (101, 'WE', 'A2');
insert into prod_order_txt values (102, 'NZ', 'A3');
insert into prod_order_txt values (103, ' to THE ', 'A4');
insert into prod_order_txt values (104, 'A5', NULL);
commit;
Thank you for your help in advance
Published by: manon March 28, 2012 13:39
-
Help for writing an extension for SQL Developer
Hi all
I want to write an extension for SQL using JDeveloper and Oracle Extension SDK developer and I have a few questions.
(1) is there some imports I need to sign up for the use of certain classes for SQL Developer?
(2) how can I do a new item from the context menu in the area of connections in the left?
(3) is there an example for this, because I have read a few posts of Sue and Kris Rice, but I figured out how to make the extensions only for JDeveloper.
Thanks in advance!SQL Developer Connection browser uses a different site from the JDeveloper Application browser id. The site id OK to use for a listener from context menu is "db_nav". If your listener statement would look like this:
My.listener.Class
Note that a listener can be registered on several sites (if, for example, you wanted as your listener to trigger for publishers, you can use "db_nav; Editor"for the site id.
You can post questions on the development of SQL Developer extensions on the developer forum SQL: SQL Developer this forum is monitored by the staff of SQL Developer.
-John McGinnis
SQL development teamPublished by: John Mcginnis, August 22, 2011 11:34
Published by: John Mcginnis, August 22, 2011 11:36
-
Hello
I need to set up a process of continuous integration for my oracle database. We plan to use Team City and SVN as source control tool. For the unit test framework, we'll add utPLSQL. But we must see a report of the code coverage for the test cases. When I Googled it I for additional information, the cone for utPLSQL does not provide for the code coverage with Jenkins, while ruby-plsql has provide. I need help in the implementation of the code coverage for my test in PL SQL framework. Based on your contributions, we will develop a model of POC and if it works perfectly, we'll use this practice to the coverage across the tests. Righ now we have two options to go to the establishment of CI process
(1) City team (Servers0 CI = > Source Control (SVN) == > build (Ant scripts) == > deploy == > Testing Framework (utPLSQL) = > Code Coverage (?) = > publish the results of the team by email)
(2) Jenkins = > Source Control (SVN) = > Build = > deployment = > Testing Framework (utPLSQL) == > = Code coverage > publish the result of the cover and test code to the team.
Therefore, choosing a Code coverage tool that is utPLSQL and integrate also with Jenkins or Teamcity. Those who have already worked on this part, please do not share your contributions and suggestions.
Thank you
Jean Yves
Hello
Basically, we take the exit of dbms_profiler and generate code coverage statistics.
-
conversion of code from sql server to oracle
Hi all, need help... I have the following sql server code and I need to convert this code in oracle... Please help me with this...
See you soon...
USE [HPSEB]
GO
/ * Object: UserDefinedFunction [dbo]. [ALG_GetData] Script Date: 2011-10-31 18:32:41 * /.
SET ANSI_NULLS
GO
SET QUOTED_IDENTIFIER ON
GO
-Select * from ALG_GetData (31)
ALTER FUNCTION [dbo]. [ALG_GetData] (int @code)
-RETURNS @Results TABLE (value nvarchar (4000))
RETURNS the array @temptb (sno int identity (1,1), meterno varchar (12), METERDATETIME varchar (35),)
eventoccuretime varchar (35), code int, int event_id, duration type varchar (35), int flag)
AS
-This function takes a parameter; It's code int
BEGIN
declare @tempdate datetime
declare @TIME varchar (35)
declare @STATUS int
declare @Duration varchar (20)
declare @METERNUMBER varchar (12)
declare @METERDATE varchar (35)
declare @event_id varchar (35)
declare @sno int
declare @tempmetno varchar (12)
declare @flag int
DECLARE MyCursor cursor static for
Select event_id, TIME, STATUS, duration, METERNUMBER, METERDATE, flag
of Xml_EVENT where CODE = @code and EVENT_Id < =.
(select MAX (EVENT_Id) of xml_event where code = @code and STATUS = 0)
order by METERNUMBER, CONVERT (date, METERDATE, 103), EVENT_Id desc
OPEN mycursor
EXTRACT NEXT FROM mycursor INTO @event_id, @Duration, @TIME, @STATUS
@METERNUMBER, @METERDATE, @flag
While (@FETCH_STATUS = 0)
BEGIN
If (@STATUS = '0')
Start
insert into @temptb (event_id, meterno, METERDATETIME, eventoccuretime, code, flag)
values (@event_id, @METERNUMBER, @METERDATE, @TIME, @code, @flag)
Set @tempdate = convert (datetime,@TIME, 103)
Set @tempmetno = @METERNUMBER
end
on the other
Start
If (@TIME <>")
Start
set @Duration = DATEDIFF (MI, convert (datetime,@tempdate, 103), convert (datetime,@TIME,103))
end
on the other
Start
set @Duration = convert (varchar, (convert (int, substring (@Duration, 5.2)) * 60) +)
(convert (int, substring (@Duration, 8, 2)))
end
Select @sno = max (sno) of @temptb
Update @temptb set Duration = @Duration where sno = @sno and meterno = @tempmetno
end
SET @event_id = "
SET @TIME = "
SET @STATUS = "
SET @Duration = "
SET @METERNUMBER = "
SET @METERDATE = "
FETCH NEXT FROM mycursor INTO @event_id, @TIME, @STATUS, @Duration, @METERNUMBER, @METERDATE, @flag
END
CLOSE MyCursor
DEALLOCATE MyCursor
-update @temptb set eventrestoretime = DATEADD (MINUTE, convert (int, time), CONVERT (datetime, eventoccuretime, 105))
RETURN
ENDtry these below
but you must make a few changes like sno you can use a sequence and each time 'select your_seq.nextval in double sno.
create or replace package pkg_ALG_GetData as
type rw is record
(number (1) number of sno, meterno varchar2 (12), METERDATEv_TIME varchar2 (35),)
eventoccureTIME varchar2 (35), code event_id number, number, duration varchar2 (35), flag of number);type rec_set is ref cursor return rw;
end;
/Create procedure ALG_GetData (code number)
-Results of PERFORMANCE TABLE (value nvarchar2 (4000))
p_ret in the pkg_ALG_GetData.rec_set) as-This function takes a parameter; This is the code number
cursor c_MyCursor is select event_id, v_TIME, STATUS, duration, METERNUMBER, METERDATE, flag
Xml_EVENT where CODE = code and EVENT_Id<>
(select MAX (EVENT_Id) of xml_event where code = code and STATUS = 0)
order of METERNUMBER, to_date (METERDATE, ' dd/mm/yyyy'), EVENT_Id desc;r_MyCursor c_MyCursor % rowtype;
tempdate date;
v_TIME varchar2 (35)
STATE number
Duration varchar2 (20)
METERNUMBER varchar2 (12)
METERDATE varchar2 (35)
event_id varchar2 (35)
number of Sno
tempmetno varchar2 (12)
Indicator number
BEGINOpen c_MyCursor;
loop
Search in r_MyCursor;
When the output c_MyCursor % notfound;
If (STATUS = '0') thenStart
Insert the number of temptb (event_id, meterno, METERDATEv_TIME, eventoccureTIME, code, flag)
values (r_MyCursor.event_id, r_MyCursor.METERNUMBER, r_MyCursor.METERDATE, r_MyCursor.code, r_MyCursor.flag)
tempDate = to_date (v_TIME, ' dd/mm/yyyy');
tempmetno = METERNUMBER;
end;on the other
Start
If (v_TIME <> ")Duration = to_date(tempdate,'dd/mm/yyyy')-to_date(v_TIME,'dd/mm/yyyy');
end;on the other
Duration = to_char (to_number (substr (duration, 5.2)) * 60 +)
TO_NUMBER (substr (duration, 8, 2)))Select max (sno)
in sno temptb;Update temptb set duration = duration where sno = sno and meterno = tempmetno;
end
event_id = ";
v_TIME = ";
STATUS = ";
Duration = ";
METERNUMBER = ";
METERDATE = ";
END
CLOSE C_MyCursor;-update temptb set eventrestorev_TIME = DATEADD (MINUTE, convert (number, duration), CONVERT (datev_TIME, eventoccureTIME, 105))
Open the p_ret for
Select event_id, meterno, METERDATEv_TIME, eventoccureTIME, code, flag
of temptb
where...;
END;
/
Maybe you are looking for
-
Unable to connect TV laptop with Intel WiDi 42VL963G
I wanted to ask you kindly a helping hand because I'm having trouble connecting my computer to the TV via intel WIDI. I declare that they are in possession of a TV TOSHIBA 42VL963G accompanied by key dongle WLM-20U2The COMPUTER AND ' a LENOVO... S300
-
My satellite phone battery does not light and the battery won't charge (rest on 2%)
Basically, my laptop is 3 months old and I don't know why it's acting weird. First of all, when I bought the laptop in June 06... the first week the laptop has no power in battery mode. So I stopped using the battery mode and still had to use my powe
-
Unexpected freezing problems randomly on Gears of War (PC)
Hello I have a computer with Vista 32 installed. The main components of the system are;-Core two 7500 Due (2.93 Ghz)-6 GB of Ram-ATI 3870 GPU (Catalyst installed 9.9) In fact, game performance is perfect, but I have the problem of unexpected freeze a
-
STOP: 0 x 00000050 blue screen/not turning on
Hello Yesterday I updated my computer with 4 or 5 updates automatic and little time after the screen flashed blue then the computer restarted before I could see what he says. It restarts successfully but later same updates came back to the top and it
-
HelloI use Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production. During the installation of the apex, I found the following errorsSQL > @/ u01/apex_test/apex/apexins APEX APEX_FILES TEMP isSP2-0310: cannot open the file 'cor