How to update data when primary key is set through for update cursor
Dear friends,
I have tried to update data in the table through forms using cursor for update and i have given the plsql i have used please help me where i do mistake.
DECLARE CURSOR EMP IS
SELECT EMPNO,EMPNAME,FATHERNAME,COMMUNITY,SEX,BILLUNIT,BIRTHDATE,RLYJOINDATE,RETIREMENTDATE
FROM PRMAEMP WHERE BILLUNIT=:CTRL.BILLUNIT AND SERVICESTATUS='SR'ORDER BY DESIGCODE,SCALECODE
FOR UPDATE;
BEGIN
GO_BLOCK('EMP_DETAILS');
SYNCHRONIZE;
FOR I IN EMP
LOOP
I.BILLUNIT:=:EMP_DETAILS.BILLUNIT;
I.EMPNO:=:EMPNO;
I.EMPNAME:=:EMPNAME;
I.FATHERNAME:=:FATHERNAME;
I.COMMUNITY:=:COMMUNITY;
I.SEX:=:SEX;
I.BIRTHDATE:=:BIRTHDATE;
I.RLYJOINDATE:=:RLYJOINDATE;
I.RETIREMENTDATE:=:RETIREMENTDATE;
DOWN;
END LOOP;
COMMIT;
END;
your help is needed immediately
DECLARE CURSOR ABC IS
SELECT EMPNO,
EMPNAME,
FATHERNAME,
COMMUNITY,
SEX,
BILLUNIT,
BIRTHDATE,
RLYJOINDATE,
RETIREMENTDATE
FROM PRMAEMP
WHERE BILLUNIT=:CTRL.BILLUNIT
AND SERVICESTATUS='SR'
ORDER BY DESIGCODE,SCALECODE
FOR UPDATE OF COMMUNITY;
V_EMPNO PRMAEMP.EMPNO%TYPE;
V_EMPNAME PRMAEMP.EMPNAME%TYPE;
V_FATHERNAME PRMAEMP.FATHERNAME%TYPE;
V_COMMUNITY PRMAEMP.COMMUNITY%TYPE;
V_SEX PRMAEMP.SEX%TYPE;
V_BILLUNIT PRMAEMP.BILLUNIT%TYPE;
V_BIRTHDATE PRMAEMP.BIRTHDATE%TYPE;
V_RLYJOINDATE PRMAEMP.RLYJOINDATE%TYPE;
V_RETIREMENTDATE PRMAEMP.RETIREMENTDATE%TYPE;
BEGIN
GO_BLOCK('EMP');
SYNCHRONIZE;
OPEN ABC;
LOOP
FETCH ABC INTO .... /*yOU NEED TO MENTION YOUR VARIABLES HERE*/;
UPDATE PRMAEMP
SET BILLUNIT= :EMP.BILLUNIT,
EMPNO= :EMPNO,
EMPNAME= :EMPNAME,
FATHERNAME= :FATHERNAME,
COMMUNITY= :COMMUNITY,
SEX= :SEX,
BIRTHDATE= :BIRTHDATE,
RLYJOINDATE= :RLYJOINDATE,
RETIREMENTDATE= :RETIREMENTDATE
WHERE CURRENT OF ABC;
EXIT WHEN ABC%NOTFOUND;
END LOOP;
CLOSE ABC;
END;
COMMIT;
END;Cheers
Sarma.
Similar Messages
-
How can I obtain the primary key of a table for an entity relation?
hello everybody
I am doing a consultation to a table in my data base, good this table has alone two fields, the first one is the code or pk and the second one is the description, to be presisos they are names of city and code.
From the beginning!!: This method this one in another class that is a Dialog that is going to call to the class SelecPlace ();
SelecPlace sl = new SelecPlace();
public void capturarLugar(){ // Simple void method in the mentioned class
String place = txtProcedencia.getText() ; // a JTextField
sl.executeStatement(place) ;
}ok, now we see part of the code of the class SelectPlace
public class SelecPlace extends AbstractTableModel{
Connection con = null;
Statement sentencia = null ;
ResultSet rs = null;
ResultSetMetaData rsmd = null ;
String[] nameColum = {} ;
Vector datos = new Vector() ;
public SelecPlace() { }
public void executeStatement(String query){
try{
con = DBManager.getConnection() ;
sentencia = con.createStatement(rs.TYPE_SCROLL_INSENSITIVE,
rs.CONCUR_UPDATABLE) ;
String sql = "select * from Place where descripcion like %"+query+"%'";
rs = sentencia.executeQuery(sql) ;
rsmd = rs.getMetaData();
int nroColumnas = rsmd.getColumnCount() ;
nameColum = new String[nroColumnas] ;
//obtengo los nombres de columnas en cache
for(int colum = 0; colum < nroColumnas; columna++){
nameColum[colum] = rsmd.getColumnLabel(columna + 1) ;
datos = new Vector();
while(rs.next()){
Vector newRow = new Vector();
for(int i = 0; i < getColumnCount(); i++){
newRow.addElement(rs.getObject("place_ID"));
newRow.addElement(rs.getObject("description"));
datos.addElement(nuevaFila);
fireTableChanged(null);
}catch(SQLException e){
System.err.println(e);
e.printStackTrace(System.err);
System.out.println("error in statement");
}catch(ClassNotFoundException cnfe){
System.err.println(cnfe);
}Ok, this code me works and I obtain in this case the field description of the table Place
Now my question is, how can I obtain the primary field of my table?
I need this value of this field that in the base of information in a bigint, and to take it to the first class before mentioned, for that I am working with a data base relatedCertain duffymo and everyone!!, good I give you my scheme:
And generalizing my question, I want to obtain the value of the primary key of a table in the database, I obtain more values of the same row, but I need the primary key, and you see one with the primary key I want to turn a Long and it to insert with code java in foreign clave in another table of the database
Good of this form I believe that it would not be breaking the integrity relacional of the tables -
How to decrypt data when you can't get the private key in Windows?
I'm very confuse. My english is poor, but I try to say my question clearly.
When browser connects to a https website which needs client certificate to authenticate the identity, the browser will send client certificate to web server.
Then the web server will use the certificate to encrypt some data and send it to browser.
Then broswer should have private key to decrypt that.
But as I know, if I install a pfx format personal certificate, I can set can't export private key, which means you can't get the private key to use it. So how can
the browser decrypt the data without private key?
By the way, what is CSP, use CSP's interface can we use CryptoAPI
to decrypt data without private key?Answer for question is "you cant"..
"How to decrypt data when you can't get the private key in Windows?"
Read more
http://msdn.microsoft.com/en-us/library/windows/desktop/aa387460(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/bb427432(v=vs.85).aspx
http://technet.microsoft.com/en-us/library/dd277320.aspx
http://en.wikipedia.org/wiki/Public-key_cryptography -
How to Work with Composite Primary Key
Hi All,
I'm working with Toplink JPA. Here I have A problem with inserting into database table which have composite Primary Key.
What I'm doing is, I have two tables. to maintain many to many relation between these two tables I created another intermediate table which consists of foreign Keys (reference) of above two tables.
Now these two foreign Keys in the Intermediate table made as composite Primary Keys.
When I'm trying to the data in the Intermediate table I'm getting the foreign Keys values are null..
could anyone suggest me how to work with composite Primary Keys
Thanks,
SatishI have the same problem, I have 3 tables with a join table joining them all. I have created an intermediate table entity. When I go to create a an entry, it says that I cannot enter null into "ID". Here is the SQl toplink generates:
INSERT INTO Z_AUTH_USER_AUTHORIZATION (CONTEXT_ID, AUTHORIZATION_ID, USER_ID) VALUES (?, ?, ?)
bind => [null, null, null]
Here are the classes:
-----------------------Join Table-----------------------------------------------
@Entity()
@Table(name = "Z_AUTH_USER_AUTHORIZATION")
public class AuthUserAuthorization implements Serializable{
@EmbeddedId
private AuthUserAuthorizationPK compId;
// bi-directional many-to-one association to AuthAuthorization
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "AUTHORIZATION_ID", referencedColumnName = "ID", nullable = false, insertable = false, updatable = false)
private AuthAuthorization authAuthorization;
// bi-directional many-to-one association to AuthContext
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "CONTEXT_ID", referencedColumnName = "ID", nullable = false, insertable = false, updatable = false)
private AuthContext authContext;
// bi-directional many-to-one association to AuthUser
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "USER_ID", referencedColumnName = "ID", nullable = false, insertable = false, updatable = false)
private AuthUser authUser;
---------------------------------------User table--------------------------------------------------------------
@Entity()
@Table(name = "Z_AUTH_USER")
public class AuthUser implements Serializable, IUser{
@Id()
@SequenceGenerator(name = "AUTH_USER_ID_SEQ", sequenceName = "Z_AUTH_USER_ID_SEQ")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AUTH_USER_ID_SEQ")
@Column(name = "ID", unique = true, nullable = false, precision = 10)
private Integer id;
// bi-directional many-to-one association to AuthUserAuthorization
@OneToMany(mappedBy = "authUser", fetch = FetchType.EAGER)
private java.util.Set<AuthUserAuthorization> authUserAuthorizations;
-----------------------------------Context table-----------------------------------------------------------------
@Entity()
@Table(name = "Z_AUTH_CONTEXT")
public class AuthContext implements Serializable, IContext{
@Id()
@SequenceGenerator(name = "AUTH_CONTEXT_ID_SEQ", sequenceName = "Z_AUTH_CONTEXT_ID_SEQ")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AUTH_CONTEXT_ID_SEQ")
@Column(name = "ID", unique = true, nullable = false, precision = 8)
private Integer id;
// bi-directional many-to-one association to AuthUserAuthorization
@OneToMany(mappedBy = "authContext", fetch = FetchType.EAGER)
private java.util.Set<AuthUserAuthorization> authUserAuthorizations;
----------------------------Authorization table-------------------------------------------------
@Entity()
@Table(name = "Z_AUTH_AUTHORIZATION")
public class AuthAuthorization implements Serializable, IAuthorization{
@Id()
@SequenceGenerator(name = "AUTH_AUTHORIZATION_ID_SEQ", sequenceName = "Z_AUTH_AUTHORIZATION_ID_SEQ")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "AUTH_AUTHORIZATION_ID_SEQ")
@Column(name = "ID", unique = true, nullable = false, precision = 8)
private Integer id;
// bi-directional many-to-one association to AuthUserAuthorization
@OneToMany(mappedBy = "authAuthorization", fetch = FetchType.EAGER)
private java.util.Set<AuthUserAuthorization> authUserAuthorizations;
I have tried to create the new entity several ways. I have tried to create one with the default constructor then set this entity on each of the other entities, I have also tried to pass in the entities to the join entity and set them there, but this doesn't work. Any help would be very appreciated!
Thanks,
Bill -
How to find out the primary key of oracle apps tables
Hii,,
My Question is How to find the primary key in the apps table...Is there any Query or other way to find out???
for eg.
I want to find out the primary key of the AP_INVOICES_ALL table...just tell me how can i get the primary key of this table.
I am currently using toad for the query..
Please guide me...you can define the primary key when you create table
or add the primary key after the table creation by 'ALTER TABLE ... ADD constraint pk_nme primary key (col1, col2)';
you could use below sql to check the detail of primary key:
1) check out the table definition directly:
select dbms_metadata.get_ddl('TABLE','EMP') FROM DUAL;
2) check out the columns of primary key:
select * from user_constraints where constraint_type='P' AND table_NAME='EMP';
select * from user_cons_columns where CONSTRAINT_NAME='PK_EMP';And BTW, it is madam, not sir. :)
Edited by: PhoenixBai on Dec 17, 2010 1:07 PM -
How do i get iphoto to NOT open automatically when i plug in my devices for updating in iTunes ??
Just so i understand. It happens when i connect my Ipad or Iphone, which i want to stop. I'm cool with it opening when I connect my camera tho. Can i customize it that way (just to open for my camera, and NOT my i-devices) ?
thx for the help -
How to push data from primary mdf file to seconday ndf files
how to push data from primary mdf file to seconday ndf files
rathnakarI'd try them over here.
SQL Server forums on MSDN
Regards, Dave Patrick ....
Microsoft Certified Professional
Microsoft MVP [Windows]
Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights. -
How can we automate the Depreciation keys based on production for business
How can we automate the Depreciation keys based on production for business u2013 this is currently not an optimised process if we expect business to manually change the keyu2019s on a monthly basis.
The end user updates the table, transaction AO25, manually on month end after the production calculations are completed. The question is, is it possible when the PP is completed, that the system updates the Period Unit table for that period?
Thanks.
Regards,
PS PSHi,
I am new at this, so I need a explanation on how will this help me, and how do I get about doing this?
Thanks a lot.
Regards,
PS PS -
Wanted to update the software now available, but it is asking for a pass code. As far as I remember in didn't put in any pass code , how do I settle this issue . Earlier updates were asking Apple ID but pass code for updating the new soft ware not known.
Hello Kewal,
Thank you for the details of the issue you are experiencing when trying to perform an update. I recommend trying to update using iTunes, and as always, it is a good idea to make a backup first.
iOS: Back up and restore your iOS device with iCloud or iTunes
http://support.apple.com/kb/ht1766
Update your iPhone, iPad, or iPod touch
http://support.apple.com/kb/ht4623
Thank you for using Apple Support Communities.
Best,
Sheila M. -
I'm trying to update to IOS6 on my New Ipad through software update under settings, over Wi-Fi ....It keeps telling me that IOS is still up to date.....? Any advice?
Maybe you have a beta version of iOS6 in your Ipad. if is this, you have to put the ipad in recovery mode in itunes and then the update will start.
To put the ipad in recovery mode, you have to turn of the ipad. In your pc/mac Itunes has to be running, and plug the cord, but when you do that you have to press the home button until a message shows up in itunes!!
Regards!! -
I have a problem with my ipad when choosing software update it is continously loading the message checking for updates without showing any results
Hello SuzMiller
Check out the article for the troubleshooting steps for issues with email on your iPhone and iPad.
iOS: Troubleshooting Mail
http://support.apple.com/kb/ts3899
Thanks for using Apple Support Communities.
Regards,
-Norm G. -
MY APPLE TV ASK TO DOWNLOAD AN UPDATE BUT WHEN IT FINISHED IT ASKED ME FOR MY WI-FI PASSWORD AND I DONT HAVE A WI-FI PASSWORD WHAT CAN I DO?
is your wifi network 100% open then?
if your router have a default name rather then one you set
then maybe it's trying to connect to another wifi network with the same name
or just another wifi network all together -
How do I remove the space key on my keyboard for cleaning underneath?
How do I remove the space key on my keyboard for cleaning underneath?
Don't. It will void the warranty. Take is to an Apple store or an AASP and have them do it.
-
What can I do to change the sound of a track in garageband? It is "stuck" on electric piano setting and will not change. I've tried restarting, restoring sound library, full key reset, and checked for updates.
Hi
In iMovie'11 (version 9.0.x)
on top menu row - Apple/iMovie/File/Edit/Cut (Can vary dep. on language - in Swedish Apple/iMovie/Arkiv/Redigera/Klipp . . . )
down Cut menu - Slow playback/Raspid Playback/Re-play in Slow Motion and onvards
Here one can select the Pre-Set speeds
Are you familiar with getting 'inspector' to run?
No - but I guess that Double Click on clip/sequense or ctrl-Click on it might open it.
Yours Bengt W -
I have a MBP form July 2011, upgraded to Lion 10.7.4. Last week I had to restore the OS.
I also bought some time ago Iphoto.
Today I wanted to install Imovie from App Store. Instead of the Buy bottom I found an Accept bottom and when I tryed to install I had the message:
These apps cannot be accepted on this computer.
Future updates of these apps can be found through Software Update.
I looked for a solution and found a lot of questions about this error but not real answers to fix it.
Can you please let me know hoe to fix?Your Mac should have had all three of the iLife apps pre-bundled with it; iPhoto, iMovie and GarageBand. If your Mac came with Mac OS X Snow Leopard installed, then the apps should be on the Install DVD that came with your Mac, perhaps in a folder on the disc labeled bundled apps. After installing them, these apps would not be updated through the Mac App Store, but with Software Update.
Maybe you are looking for
-
I have tried to look for an extension like Air Print Activator, which I tried and ignored. I thought it might have some timing method that would stop my copying and pasting and moving files after a minutes ot two. So I re-installed the latest version
-
Single Sign-On and Context Propogation
I would like to implement single sign-on to my Web Container and have the LoginContext propogated to the EJB Container. Can anyone point me to resources / documentation on this topic? thanks, tom~
-
Cisco ASA 5505 - 2 PPPoE connection
Hi, Please I would be very pleased if someone could give me a hand in this matter. I have a Cisco ASA 5505 9.0(2), 2 dial-up connection (ADSL) with fix IP from the same ISP. I have 2 Linksys router (each dial-up has a router) as well. Both Linksys ar
-
Changing Text property of TextObject at runtime has unexpected results
I'm using the version of Crystal Reports that ships with VS 2008. At runtime, I'm replacing the text of a TextObject with new text. This works fine when the TextObject contains only literal information, but when the TextObject contains a formula fiel
-
PDF Form Password Permission Question
I'm new to creating PDF forms and have Acrobat 9 Pro. I'm creating a form for a client who is asking if I can put two passwords on the form: 1. a password that enables my client (Client A) to open the form, enter info in the fields, save as something