I’ve never seen a statement written like that before, so I have no idea if it will definitely work.
What I would have done is changed the values valued to …
Values ( select distinct 20, uos_pidm_id (…) …
However some questions come to mind.
Do you need distinct? Can there be more than one email address for the given code of 201620? Distinct implies a sort. Also it looks like you are calling a function to get the I’d, that would imply a single return value, unless it was a pipelined function, but they have different calling conventions. So I don’t think you need or want the distinct.
You also don’t appear to have an environment where you can test things out. There’s nothing worse for a dba to be handed a script to run, perhaps out of normal hours, and for the script to fail. You must get yourself a database where you can test your scripts so that the dba gets a working script.
If you don’t have one around, where do your developers test their code? Surely they font just hand over scripts to the dba, untested?
Assuming you have a Windows pc, you can download Oracle XE for free use, including commercial. It’s 11g but not the latest. You might, of course, have problems getting permission to do that, but you should ask. Good luck.
It’s not really viable to be handing over code you think works.
Sorry about the rant, I’m a dba!
On 11 February 2017 18:06:39 GMT+00:00, jollydoe firstname.lastname@example.org wrote:
Inserting a hard coded value & a value from a select statement
Thread created by jollydoe
(Note: I do not have insert or update or delete privilages)
Will following insert statment work (i.e to insert a hard coded value & a value from a select statement into Oracle 11g table using Toad 10.6)? Before share this script with our DBA for him to run, I want to make sure that my code is valid.
INSERT INTO GOREMAL (GOREMAL_EMAL_CODE, GOREMAL_EMAIL_ADDRESS)
VALUES (‘20’, ( SELECT DISTINCT UOS_PIDM_ID(SIRASGN_PIDM)||’@sharjah.ac.ae’
WHERE SIRASGN_TERM_CODE = ‘201620’
AND NOT EXISTS ( SELECT GOREMAL_PIDM
WHERE GOREMAL_EMAL_CODE = 20
AND GOREMAL_PIDM = SIRASGN_PIDM
Basically, I want to find out if I can use both hard coded values and a select ststament in a single insert statement.
To reply, please reply-all to this email.
Stop receiving emails on this subject.
Or Unsubscribe from Toad for Oracle Forum notifications altogether.
Toad for Oracle - Discussion Forum
Flag this post as spam/abuse.
Sent from my Android device with K-9 Mail. Please excuse my brevity.