Procedure inserting different number of records in GT table
I have procedure, in the procedure a dynamic query is get created. Then query is open using OPEN for statement into refcusror. Then I'm fetching the data into record type object within a loop..end loop and inserting the records in a GT table.
But problem is for the same data procedure is inserting less records, when i recomplie the procedure it began to insert correct number of data.
I wonder whether is environment issue or something else? Please advise if any one faced such type problem.
Hi upennit. Not much info to go on there.
Have a read of Re: 2. How do I ask a question on the forums?
then post back with some relevant info.
Similar Messages
-
Create Store Procedure to Count Number of records in Database for each table
Hello,
I have created the code which counts the number of records for each table in database. However, I want create store procedure for this code this code that when ever use execute the Store Procedure can provide the database name to execute it and as a result
table will display number of records in each table.
Below you will find the code its working:
CREATE
TABLE #TEMPCOUNT
(TABLENAME
NVARCHAR(128),
RECORD_COUNT BIGINT)
-- Creating a TEMP table
EXEC
sp_msforeachtable
'insert #tempcount select ''?'', count(*) from ? with (nolock)'
SELECT
* FROM
#TEMPCOUNT
ORDER
BY TABLENAME
DROP
TABLE #TEMPCOUNT
This code need to be convert in store procedure and user can give database name when execute the procedure in order to count the records.
Looking forward for your support.
Thanks.
SharePoint_Consultant_EMEASomething like:
set quoted_identifier off
go
create procedure usp_TableCounts
@DBName as varchar(1000)
as
set nocount on
declare @SQLToExecute varchar(1000)
CREATE TABLE #TEMPCOUNT (TABLENAME NVARCHAR(128), RECORD_COUNT BIGINT) -- Creating a TEMP table
set @SQLToExecute = @DBName + ".dbo.sp_msforeachtable 'insert into #tempcount select ''?'', count(*) from ? with (nolock)'"
print @SQLToExecute
exec (@SQLToExecute)
SELECT * FROM #TEMPCOUNT
ORDER BY TABLENAME
DROP TABLE #TEMPCOUNT
GO
Satish Kartan www.sqlfood.com -
Different number of records in RSA3 for Full and INIT
Hi All,
I am about to load the data from 0FI_GL_4 and checked it in RSA3 for the number of records. It returned different number of records when I run the extract with options 'F' and 'C'. Why is it so? This is the first time I am loading the data into BW for this datasource. I would expect the number of records to be same if I do either a full extract or an init but surprised by seeing different number of records.
Best Regards,
James.Hi James,
Probably it's because of the time stamps stored in table BWOM2_TIMEST.
If you run a delta init and than a delta update then the number of the records should match with the record of the full update.
You can find some more info about table BWOM2_TIMEST here:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/a7f2f294-0501-0010-11bb-80e0d67c3e4a#527,7,Timestamp%20Mechanism:%20New%20documents
Bye,
Zsolt -
To insert N number of values in a table for backup
Hello experts,
I need to insert N number of values in a table using
SQL or PL/SQL. Please help me to do this.
i have tried this. but not working
CREATE PROCEDURE P1
AS
-- start loop & repeat N times
INSERT INTO [T1]
([Value])
VALES
(:value)
INSERT INTO [T2]
([valueID])
VALUES
(:IDENTITY)
-- END LOOP
END;>almost i got the answer.
Then is it not time to close the thread as mark it Answered ?
Or, your "almost" requires more ...!
Regards
Girish Sharma -
Number of records in SETUP table
Hello
I am working with PO extractor. Is the number of records in XXXXXXSETUP table equal to the number of records setup?Hi if I understand the question the answer is no. For example I have recently carried out a setup run for Stock Initialisation MC03BX0SETUP.
The number of records in this table is just over 4000 and when I carry out an opening balance load to BW for the 2LIS_03_BX the number of records are just under 2million
The setup tables are cluster tables -
NUMBER OF RECORDS IN EACH TABLE???
Hi!
how can i find the number of records in each table in the database. the result should be like this
table_1 123
table_2 60
table_3 88
thanks!!
also if we want to see it only for a particular schema???You can get all the table names and schemas from ALL_TABLES table.
then you can stored that on a cursor,
then you can create a function where you use an execute_immediate to run the queries dinamically. with that you can run a COUNT for each TABLE
That's the idea give it a shot :)
Regards -
How to retrieve one row from the number of records in a table
i want to retrieve the rows from the number of records in a table without using the perticular column name.
select count(*) from table
/If you have your table currently analyzed, and no changes have been made, then you could
select num_rows from user_tables where table_name = 'table' -
Number of record with multi-table insert
Hi,
I need to insert into 3 different tables from one big source table so I decided to use multi-table insert. I could use three inserts statements but the source table is an external table and I would prefer not reading it three times.
I wonder if there is a way to get the exact number of records inserted in each one of the tables?
I tried using rowcount but I all I get is the number of rows inserted in all three tables. Is there a way to get this info without having to execute a "select count" in each table afterward?
Thanks
INSERT /*+ APPEND */
WHEN RES_ENS='PU' THEN
INTO TABLE1
VALUES(CD_ORGNS, NO_ORGNS, DT_DEB, SYSDATE)
WHEN RES_ENS='PR' THEN
INTO TABLE2
VALUES(CD_ORGNS, UNO_ORGNS, DT_DEB, SYSDATE)
ELSE
INTO TABLE3
VALUES(CD_ORGNS, NO_ORGNS, DT_DEB, SYSDATE)
SELECT ES.CD_ORGNS CD_ORGNS, ES.RES_ENS RES_ENS, ES.DT_DEB DT_DEB, ES.NO_ORGNS NO_ORGNS
FROM ETABL_ENSGN_SUP ESI have a large number of data to load in those three tables. I do not want to use PL/SQL (with loops and lines of codes) because I can do the insert directly from the source table and it saves a lot of time.
INSERT /*+APPEND*/
WHEN condition1 THEN
INTO table1
WHEN condition2 THEN
INTO table2
SELECT xx FROM my_table
For example, if my_table has 750000000 rows, I only need to read it once and the INSERT..SELECT is a really fast way to load data.
As I was saying, the only problem I've got, is that I cannot get the number of rows in each table. Do you know a way to get it? -
Oracle Procedure returning more number of records
Hi,
I have created an Oracle Procedure which is supposed to fetch a record as per the input parameter passed.
The core query in the procedure is as below -
SELECT DISTINCT col1 FROM my_tab WHERE col2 = 'Input parameter'
Few of the input parms (col2) has more number of records (col1) and so the procedure gives an error like -
'ORA-01422: exact fetch returns more than requested number of rows'
Could you please let me know how can I modify the procedure so that it would return more number of records as the case may be?
Thank you!It still gives me the same error when it encounters more than one output.Yes, I'm sure it does.
But we can't tell you how to fix it because we don't know what you want.
What's the purpose of the procedure?
Is it to "spell check" the name of an intermediary? If so, you'll need to figure out what to do when you have more then one person with the same name.
You can add AND ROWNUM = 1. Or perhaps you can trap the too_many_rows exception.
Your procedure doesn't return anything (no out variables). Is that correct?
Or is the purpose of the procedure to return the ID of the matching name? -
How to restrict user to insert certain number of records (urgent)
i have master detail Form. My requirement is as following.
1) In master block user enter other information and enter suppose 5 in text item.
2) Then 5 rows should be display in detail block. and user couldnt enter more than 5 records in detail block.i hope understand,
To close a query when :max_record = TO_NUMBER(:global.max_rec) and
keep count of the number of records retrieved,
create a POST-QUERY trigger.
IF :parameter.max_record = TO_NUMBER(:global.max_rec) THEN
ABORT_QUERY;
ELSE
:global.max_rec := TO_CHAR(TO_NUMBER(:global.max_rec) + 1);
END IF;
:parameter.max_record = number record you want retrieve and set in PRE-FORM
Hope help you -
COPA pulling different number of records each time?
Dear Friends,
I ran a COPA full load for (with Infosource 1_CO_PA_COSTING and) for a the same range of 0FISCPER (three periods)and the load brought different no of records each time. It brought 30,000 records the first time, 3 the second time and 1 the third time. All these loads were run with in 10 minutes. What possibly is the reason? Please share your thoughts?
Thanks
Raj
Message was edited by: Raj SinghDear Friends,
I ran a COPA full load for (with Infosource 1_CO_PA_COSTING and) for a the same range of 0FISCPER (three periods)and the load brought different no of records each time. It brought 30,000 records the first time, 3 the second time and 1 the third time. All these loads were run with in 10 minutes. What possibly is the reason? Please share your thoughts?
Thanks
Raj
Message was edited by: Raj Singh -
Good Morning All,
I'm using a SSIS package to load data into the DWH. The source is ORACLE and destination is SQL SERVER. My first question is :
1) There is a column in the source table "FULLDATETIME" datatype "DATE". But when i load it into the SQLSERVER its stored as date with timestamp.
For example in the source column if the value is "05-FEB-14" in the destination table its loaded as "2014-02-05 21:15:00.000".I'm not using any transformation it is a straight load.
2) My second question is i want to schedule this package to just load the delta records, for this i'm using the FULLDATETIME column from the Source table and want to load just the previous date's records. Please see the below queries i'm getting two different
sets of records. The first SQL is giving me 5 records and the second one is giving me 1619 records. I'm confused as both queries mean the same.
select t1.*,t2.year,t2.monthofyear,t2.dayofmonth,t2.fulldatetime
from TABLEA t1
inner join TABLEB t2
on t1.intervalkey=t2.datekey
where t2.fulldatetime=trunc(sysdate)-2
select t1.*,t2.year,t2.monthofyear,t2.dayofmonth,t2.fulldatetime
from TABLEA t1
inner join TABLEB t2
on t1.intervalkey=t2.datekey
where t2.year=2014
and t2.monthofyear=2
and t2.dayofmonth=5
Please advice as what i'm overlooking here.
ThanksThanks Tom Phillips,
If you look at my above queries i'm joining those to load the first table TABLEA every night with the delta records. When you said that the YEAR, MONTHOFYEAR and DAYOFMONTH are not based on FULLDATETTIME i'm confused as all these columns are part of the
TIME DIMENSION table in the Source, on the othr hand in my second query i have FULLDATETIME field and when i run the sql for the 1619 records it shows the '05-FEB-2014' Value. Is there a way where i can load just the records from the previous day based on
these fields (YEAR,MONTHOFYEAR,DAYOFMONTH)?
e -
SD extractors - different number of records in RSA3 and in the table MC*
Hi
After deleting setup tables and creating it again
for extractor 2LIS_11_VAITM
I have
in RSA3 - 64686 records
but
in MC11VA0ITMSETUP structure only 14857.
The same situation is for 2LIS_11_VASTI.
Where this difference is getting from?
Thanks
PWnukThe reason is that the MC* setup tables "cluster" the data, so there is not a 1 to 1 match in record count. Therefore, you shouldn't validate using record counts between the setup tables and RSA3.
See these links:
Re: no of records in setup tables
Hope this helps -
How to speed up insertion of 10,000 records into a table
Hi,
I have one table with 40 fields in which have several not null, 6/7 randomly generated (through trigger) fields and 8/9 indexes including pk and uk. Now i have to insert 10,000 records at a time through a procedure using loop. But it takes time => 00:01:05.25. I need the task within 2/3sec. Can anyone help me in this regard urgently ....below is my code:
=>
CREATE OR REPLACE PROCEDURE sp_batch (v_batchid batch.batch_id%TYPE)
IS
batch_rec batch%ROWTYPE;
batchdesc_rec batch_desc%ROWTYPE;
v_acctid user.acct_id%TYPE := 0;
v_companyname user.company_name%TYPE;
v_masteracctconfdefid master_acct_conf_def.master_acct_conf_def_id%TYPE;
v_timezoneid time_zone.time_zone_id%TYPE;
v_ispostpaid sys_conf.is_post_paid%TYPE;
v_isacctactive sys_conf.is_acct_active%TYPE;
v_maxcalllimit sys_conf.max_call_limit%TYPE;
v_maxcalltime sys_conf.max_call_time%TYPE;
BEGIN
SELECT *
INTO batch_rec
FROM batch
WHERE batch_id = v_batchid;
SELECT * INTO batchdesc_rec
FROM batch_desc
WHERE batch_desc_id = batch_rec.batch_desc_id;
SELECT a.company_name, m.master_acct_conf_def_id
INTO v_companyname, v_masteracctconfdefid
FROM master_acct_conf_def m, user a
WHERE a.acct_id = batchdesc_rec.master_id
AND a.acct_id = m.master_id;
SELECT time_zone_id
INTO v_timezoneid
FROM time_zone
WHERE acct_id = batchdesc_rec.master_id;
SELECT is_post_paid, is_acct_active, max_call_limit, max_call_time
INTO v_ispostpaid, v_isacctactive, v_maxcalllimit, v_maxcalltime
FROM sys_conf;
v_acctid := batch_rec.start_acct_id;
FOR i IN 1..batch_rec.num_of_acct LOOP
INSERT INTO user(acct_id, master_id, batch_id, add1, auth_type_id, acct_type_id, acct_status, rate_def_id,
route_def_id, max_call_limit, max_call_time, is_post_paid, company_name, is_vm_enabled)
VALUES(v_acctid, batchdesc_rec.master_id, v_batchid, 'Address', batch_rec.auth_type_id, 1, v_isacctactive, batch_rec.rate_def_id,
batch_rec.route_def_id, v_maxcalllimit, v_maxcalltime, v_ispostpaid, v_companyname,batch_rec.is_vm_enabled);
INSERT INTO account
VALUES (v_acctid, batch_rec.batch_face_value, 0, localtimestamp, null, batch_rec.exp_days, 1,localtimestamp);
INSERT INTO master_acct_conf
VALUES (masteracctconf_seq.NEXTVAL, v_masteracctconfdefid, v_acctid, DEFAULT, DEFAULT);
INSERT INTO time_zone
VALUES(v_timezoneid, v_acctid, DEFAULT, NULL);
v_acctid := v_acctid + 1;
END LOOP;
UPDATE batch SET batch_status_id = 2 WHERE batch_id = v_batchid;
commit;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20001,'The error from sp_batch => '||sqlerrm);
END;
Now tell me how can i speed up this insertion for 10,000 records? -
How to restrict the number of Records into the Table?
Is there any way that I can restrict the number of records can be entered into the table?
For example I have created a table TAB1 with size category 0( zero).
User dont want to enter more than 100 values, How to restrict the number entries? Whether Basis can do it?
Regards,
PrathapHi Prathap,
You can write a code in table maintenance events to restrict the number of Records added into the Table to constant.
Solution:
Se11 -> enter table name (TAB1) -> F6 -> Utlities -> Table maint. generator -> Envirnment -> modification -> events -> write here the form routine name.
Double click on routine name. You will get into include section of the code. Write here code like:
IF current_rec_num > 100.
messgae error 'Entry restriceted to 100'
ENDIF.
Somewhat this way you can achieve your target.
Regards,
Sachin
Maybe you are looking for
-
I am trying to create a new line by returning a variable from a function by coding the following which worked for the last version of HTML_DB and understood that after my variable named vlname I wanted a new line msg := 'NAME: ' || vlname ||'<br><br>
-
Hi, I have a doubt in connection pooling. I we create 100 connections in a connection pool, when do the connections created or assigned? Is it during the login time or during there is a request for the connection? Please explain the doubt in detail.
-
Forms Trigger Hirarchy for Execute query operation
Hi Can anybody tell me in which order triggers are executed in oracle forms when i press a execute query button. ON-POPULATE-DETAILS ON-CHECK-DELETE-MASTER POST-QUERY i want to write a code after completion of all the operations of execute_query requ
-
User CRYSTAL has no RFC authorization for function group BDL5
I am getting this error. Can anybody help. T:40527 Error in program 'boe_cmsd': ======> User CRYSTAL has no RFC authorization for function group BDL5. T:40527 Error in program 'boe_cmsd': <* RfcReceive [3] : returns 3:RFC_SYS_EXCEPTION T:40527 Error
-
Hi All, I have imported xsd files as external definitions. They are showing messaages list without any space.While using them in message mapping they are not showing the fields. Even in the case of direct import into message mapping also the same res