Insert to table as select only some values
Hi all,
I have those two table
Table ANAGUTEN
CODI_UTEN NOT NULL NUMBER(5)
NOME_UTEN NOT NULL VARCHAR2(30)
PASS_UTEN NOT NULL VARCHAR2(30)
Table RELAUTENPROF
CODI_PROF NOT NULL NUMBER(5)
CODI_UTEN NOT NULL NUMBER(5)
The problem is that only some records of ANAGUTEN are in RELAUTENPROF, but this is an error.
How can I insert into RELAUTENPROF only the record (the field CODI_UTEN) that are in ANAGUTEN and that aren't into Relautenprof.
Is there a single statment to do this. I wouldn't use a pl/sql procedure
Note: the codi_prof is always = 2
Thank's and sorry for the simple question
Paolo
Here's three, I can think of at least three more.
INSERT INTO relautenprof
SELECT 2, codi_uten
FROM anaguten
WHERE codi_uten NOT IN (SELECT codi_uten
FROM relautenprof)
INSERT INTO relautenprof
SELECT 2, codi_uten
FROM anaguten a
WHERE NOT EXISTS (SELECT 1
FROM relautenprof r
WHERE r.codi_uten = a.codi_uten)
INSERT INTO relautenprof
SELECT 2, codi_uten
FROM (SELECT codi_uten
FROM relautenprof
MINUS
SELECT codi_uten
FROM anaguten)John
Similar Messages
-
Insert into table a (select * from table b) - need pk?
Hi there.
I'm going to insert into table FINAL (select * from table STAGING) - same structure but in STAGING the ID column has nulls.
Do I need to provide the ID (primary key) for table FINAL or will it get created based on sequence/trigger?
If I were doing this in a loop I'd get the next val from the sequence but on a simple insert, I'm curious.
thanks!hmm.. what is ?
it didn't like it.
Error(11,4): PLS-00103: Encountered the symbol "[" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-identifier> <a bind variable> << close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge <a single-quoted SQL string> pipe
9i, sqldeveloper -
ALV - how to make selectable only some rows on an ALV?
Hi my problem is:
I have an ALV GRID as output of a report.
I have to make selectable only few rows based on the contents of a field (showed in a column in the ALV).
Is it possible?
Best Regards, VincenzoI did understand, but as i told you there is nothing like that, neither an option nor an event to capture.
Here is the documentation: http://help.sap.com/saphelp_erp2005vp/helpdata/EN/bf/3bd1369f2d280ee10000009b38f889/frameset.htm
Read it and choose what you need and what is in existance. -
Select ONLY certain values...issue
Post Author: Ria Shaw
CA Forum: Formula
As an e.g. I would like to select user who are = x, y, z ONLY
I want to exclude users who are = x, y,z and a,b, c etc.
The problem is that the etc I mentioned above is literally hundreds of values in the table.
How woud I do that?
Thank youPost Author: Charliy
CA Forum: Formula
Need a better idea of what your data looks like to give a definitive answer. What do you mean by user who are - x, y, z?
There was an earlier post you might want to dig for. The heading was something along the lines of 'Select if and only if" In that case they wanted to list an item only if all its sales were at store #2. I think it was about a month ago. -
Query to select only Y values , if all are Y, say All
Kinldy provide me the query
select * from FILTER_User
CREATE TABLE [dbo].[FILTER_User](
[UserName] [nvarchar](128) NULL,
[Is_Member] [char](1) NOT NULL
INSERT INTO FILTER_User (UserName, Is_Member) VALUES ('Raj', 'Y')
INSERT INTO FILTER_User (UserName, Is_Member) VALUES ('Ravi', 'Y')
INSERT INTO FILTER_User (UserName, Is_Member) VALUES ('Kumar', 'Y')
INSERT INTO FILTER_User (UserName, Is_Member) VALUES ('Gopal', 'Y')
-- If all the Values in [Is_Member] is Y, display all
select * from FILTER_User
Expected Result
All
INSERT INTO FILTER_User (UserName, Is_Member) VALUES ('Sridhar', 'N')
INSERT INTO FILTER_User (UserName, Is_Member) VALUES ('Aravind', 'Y')
-- If all the Values in [Is_Member] is not Y, display the names which are Is_Member] Y
select * from FILTER_User
Expected Result
Raj
Ravi
Kumar
Gopal
Aravind
ShanmugaRajCheck this:
declare @filter_user table(name varchar,Is_Member varchar(10))
insert @filter_user select 1,'Y'
insert @filter_user select 2,'Y'
insert @filter_user select 3,'Y'
insert @filter_user select 4,'Y'
declare @sumy int,@sumall int
select @sumy=sum(case Is_Member when 'Y' then 1 else 0 end) ,@sumall=sum(1)
from @filter_user
if(@sumy=@sumall)
select 'All' as result
else
select name as result
From @filter_user
where Is_Member='Y'
Thanks,
Jay
<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'> -
INSERT INTO TABLE using SELECT takes long time
Hello Friends,
--- Oracle version 10.2.0.4.0
--- I am trying to insert around 2.5 lakhs records in a table using INSERT ..SELECT. The insert takes long time and seems to be hung.
--- When i try to SELECT the query fetches the rows in 10 seconds.
--- Any clue why it is taking so much timevishalrs wrote:
Hello Friends,hello
>
>
--- Oracle version 10.2.0.4.0
alright
--- I am trying to insert around 2.5 lakhs records in a table using INSERT ..SELECT. The insert takes long time and seems to be hung.
I don't know how a lakh is, but it sounds like a lot...
--- When i try to SELECT the query fetches the rows in 10 seconds.
how did you test this? and did you fetch the last record, or just the first couple of hundred.
--- Any clue why it is taking so much timeWithout seeing anything, it's impossible to tell the reason.
Search the forum for "When your query takes too long" -
Inserting into table whith select query...
Hi All,
I am having requirement where
INSERT into employee_Temp (emp_id,emp_name,emp_email) (select emp_id,emp_name,emp_email from EMP where sal > 300) order by emp_name.
Here EMP table has Toplink mapping to a java object.So I have constructed the select part of the query using ReportQuery.
Can you help me in constructing the complete query so that employee_Temp will be populated in one shot.
I am using Toplink Toplink9.0.3
Thanks in Advance,
Ashwin BTopLink does not currently support an InsertAllQuery, (10.1.3 added an UpdateAllQuery, and DeleteAllQuery will be supported in 11.1.1).
You will need to use SQL for your query. -
Hi all,
I've a query with more than 500 rows as result. I'm only interested to show the first 50 rows. Did you know any way to prepare the select sentence to do it? I prefer avoid use cursors to do that.
Regards,
dbajugHitesh Nirkhey wrote:
hi
use ROWNUM keyword for fetching first 50 rows
simplest example
select * from emp
where rownum < 5 ;
regards
HiteshROWNUM applies to the rows after they are collected into a result set. Thus, it may, or may not, fulfill the OP's requirements. He still needs to define what he means by "first 5 rows".
http://psoug.org/reference/pseudocols.html
Also see description of ROWNUM in the fine SQL Reference manual -
Select only some faces to scan
can you set it up so it only scans some events with faces so it does not take the hours it does to scan all?
that is what i thought. thank you for the reply.
-
Hi,
I want to insert data into table by subquery and some value by manully.
How can I insert data into table.SQL> create table t(no integer, obj_name varchar2(100))
2 /
Table created.
SQL> create sequence my_seq
2 /
Sequence created.
SQL> create or replace function get_next_val return integer
2 as
3 lSeq integer;
4 begin
5 select my_seq.nextval into lseq from dual;
6 return lseq;
7 end;
8 /
Function created.
SQL> insert into t
2 select get_next_val,
3 MAX(object_name)
4 from all_objects
5 where object_type = 'TABLE' group by owner
6 /
17 rows created.
SQL> select * from t
2 /
NO OBJ_NAME
1 PSDBOWNER
2 SDO_XML_SCHEMAS
3 SRS$
4 DM$P_MODEL_TABLES
5 OL$NODES
6 SYS_IOT_OVER_40928
7 XML_LOAD_RECORDS
8 T
9 SQLPLUS_PRODUCT_PROFILE
10 SYS_IOT_OVER_42490
11 SALGRADE
NO OBJ_NAME
12 MGMT_TEMPT_SQL
13 SI_VALUES_TAB
14 SYS_IOT_OVER_49872
15 xdb-log9_TAB
16 XDB_INSTALLATION_TAB
17 WM$WORKSPACE_SAVEPOINTS_TABLE
17 rows selected.
SQL> -
WD4A select options, default value
Hello,
while using the select option screen i tried to fill a default value in one of my fields. I used:
*add a new field to the selection
wd_this->m_handler->add_selection_field(
i_id = 'Z_TEST'
it_result = lt_range_table
i_memory_id = 'SXV'
i_no_intervals = abap_true
i_no_extension = abap_true ).
I checked that the parameter ID SXV is filled but there is no default value in the dynpro.
Any ideas?
best regards
stefanHi Stefan.
Is it necessary to use memory id's for you?
It is quiet easy to work with field-symbols and
add a value to the range table:
data:
ls_tmprange type rsparams.
field-symbols:
<fs_param> type any,
<fs_range> type any,
<fs_rangetable> type table.
ls_tmprange-low = some value.
ls_tmprange-sign = some value.
ls_tmprange-option = some value.
assign lt_range_table->* to <fs_rangetable>.
create DATA lr_headerline like LINE OF <fs_rangetable>.
ASSIGN lr_headerline->* to <fs_range>.
move-CORRESPONDING ls_tmprange to <fs_range>.
append <fs_range> to <fs_rangetable>.
After that you can call add_selection_field with lt_range_table.
Hope this helps.
Cheers,
Sascha -
Up Dating selected pulldown list values
Hi
I have created a copy of the internal transfer PCR. I have added a new pull down list for Pay Band along with a text field. I have added the selection field and an Overlay field as per the normal pulldowns. I have coded the BADI and the list is displayed and a value can be selected. All seems OK until
When the PCR is saved and the data in the notification is checked the New value of Pay band is there but not the new text. I would expect that I have to code this update of the text field. I have checked the call to all the methods of the BADI and none seem to get called for my pulldown.
I have added the code to raise an event using the same code as per the PERSK pulldown field. When i use the same code the form is refreshed but if i change the event name to something else the form is not refreshed. I would have expected that the method Process user command would have been called but this does not seem to be happening.
How do you check that a value in a pulldown as changed so that text fields can be updated
Trev BHi,
I think you can use the USER_COMMAND method itself for your case. Please put a condition if USER_COMMAND = 'SEND' or USER_COMMAND = 'APPROVE' or USER_COMMAND = 'REJECT' what sover action that executes before submission, then get the value of Pay Band from SPECIAL DATA Internal Table and select the Text value from ECC based on the this Pay Band and set this characteristic text value back into the SPECIAL DATA Internal table.
I hope this will help you.
Regards,
<i><b>Raja Sekhar</b></i> -
KE3I transport only specific value field
Hello :
I would like to transport only specific value field like vv001 in KEA6.
I understand that use KE3I select ABAP repository but not choice to select only specific value field. Please advise.
ManthanaHI,
its not possible to transport only a specific value field. If the value field is assigned to an operating concern, the CE1**** data structure is changed and therefore the whole transport procedure (see numerous other threads in SDn-forum) has to be followed.
best regards, Christian -
NULL values are inserted into interface table for read only columns
Hi, I developed a custom Integrator where some of the columns has to be displayed as read only in the layout. I am using SQL content to populate the data. When I upload the data NULL values are inserted into table interface? Is there any work around for this?
Thanks
Edited by: user593879 on Jan 12, 2010 7:21 PMDoesn't WebADI drive you insane at times?
I must say, when it's all working it looks great and it is very user friendly (end-user that is, NOT for developers!) but before you get to that stage… please please Oracle invest some time making Web ADI a bit more logical an coherent, get the obvious bugs out, please let us not have to update BNE tables anymore to get things done.
Anyway, I sorted this one out by setting the Width to zero (0) in the Layout. HTH. -
I Cant insert all values to the table But only Default Values r inserted?
Hai,
i can insert only default values to the database. Other values are not shown in DB.
Steps I have done so far:
I have created EO based on VO and VO has the query : select * from emp. Attached to AM.
That AM is attached to the Page. The page consists of employeed details and SAVE button.
Set controller for that page and CO-PR calls create method in AM .
Default values for who columns and SLNo also set through sequence.
In CO-PFR I call apply method which commits the data.
when i run the page and giving values it is not inserted into table but only default values are inserted.
I checked with System.out.println(getattribute("my attr").toString()). It send output correctly.
But y other values are not inserted.?
Anybody plz plz help me in this regard. I am struggling with this for last 1 week. I have to apply this to another realtime scenorio? Deadline is near.
Regards,
Lakshmi ChandiranHai Prince,
Thanks for your immediate response. pls find my codes written in EO,AM,CO.
In VO i havent added anythig xcept the query.
The following fields are only getting inserted in the table.
My EOImpl code:
public void create(AttributeList attributeList) {
super.create(attributeList);
System.out.println("NOW I AM IN CREATE METHOD");
OADBTransaction transaction = getOADBTransaction();
Number EMP_ID = transaction.getSequenceValue("Employeeid");
setEmpId(EMP_ID);
setCreationDate(transaction.getCurrentDBDate());
setStartDate(transaction.getCurrentDBDate());
setLastUpdateDate(transaction.getCurrentDBDate());
setCreationDate(transaction.getCurrentDBDate());
VO:
select * from emp1
AM:
public void saveForm()
OAViewObjectImpl empvo = getEMP_VO();
System.out.println("NOW I AM IN AM SAVEFORM OF EMTS");
if ( !empvo.isPreparedForExecution())
empvo .executeQuery();
Row prow = empvo .createRow();
empvo .insertRow(prow);
prow.setNewRowState(Row.STATUS_INITIALIZED) ;
System.out.println("NOW I AM IN ROW CREATED");
public void commitdata()
System.out.println("commitMethod()") ;
getDBTransaction().commit();
CO:PR & PFR:
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
if(!pageContext.isFormSubmission())
pageContext.getApplicationModule(webBean).invokeMethod("saveForm",null);
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
OAApplicationModule EMP_AM = pageContext.getApplicationModule(webBean);
OAViewObject vo = (OAViewObject)EMP_AM.findViewObject("EMP_VO");
if ( pageContext.getParameter("BtnSave") != null )
pageContext.getApplicationModule(webBean).invokeMethod("commitdata");
s1 = (String)vo.first().getAttribute("Empname");
s12 = (String)vo.first().getAttribute("Emptype");
s3 = (String)vo.first().getAttribute("Emporg");
s4 = (String)vo.first().getAttribute("Empcity");
System.out.println(" values are " + s1+s2+s3+s4);
here i can get the values correctly printed in output as entered in the form.
I dont know where the problem is.
plz help me.
Thanks in advance,
Regards,
Lakshmi Chandiran
Maybe you are looking for
-
Error when try to start the sap system in SAPMMC
Hello gurus, I´m faccing with a serious problem, I´m trying to figure out a solution for this but I don´t get it!! My God.. Database - MS SQL 2005 System- ECC 6.0 OS- Win 2003 Server X64 When I tried to start the system by SAPMMC the system keep in w
-
Crystal Report 10 take toomuch time to display report
hi every one i have designed some reports with crystal report 10. i am using classic ASP and windows 2003 Enterprise server as web server. The problem is that when i browse the report in Internet explorer, it takes too much time to display the repor
-
No connection with my Asus RT-N66U router to Infin...
Hi experts, The BT engineer came round to set up my new BT Infinity broadband earlier today. I was unhappy to find I was only hitting 16mb download speeds compared to the advertised maximum of 76mb. Previously I was using TalkTalk using a T-Link 8177
-
Hi all, Has anyone came across encryption code, such as DES, written in PL/SQL? I found two files in Oralce 8.1.6, namely $ORACLE_HOME/rdbms/admin/dbmsobtk.sql & prvtobtk.plb. These files created a package called DBMS_OBFUSCATION_TOOLKIT which contai
-
Disable "Your site has been published" Message
Does anyone know how to turn off the Your site has been published message? Every time you upload a change to mobileme this obnoxious message pops up which is ok once, but after awhile it becomes tedious.