How to handle a number of records in stored procedure?
i wanna handle a number of records in a stored procedure one by one.
what should i do?
can any one give me some sample about the following question?
Q:
tb_main,tb_attach are two tables.
i want to create a procedure to write off a record in tb_main. before do that, i want to write off all records in tb_attach which is related with the record to be written off in tb_main. and a procedure named pr_write_off_attach for writing off a record in tb_attach has been created already.
what should i do?
help!!
null
Dg.dataProvider.length is the number of records in the ArrayCollection
Dg.rowCount is the number of visible rows.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui
Similar Messages
-
Who know how to handle pl/sql table return from stored procedure calling from jsp
I have some stored procedure which return pl/sql table (index by table), It is look like an array. how jdbc handle this?
CallableStatement cs = con.prepareCall("EXECUTE bill.getcountry(?,?)");
cs.setInt(1, cid);
cs.registerOutParameter(2, java.sql.Types.VARCHAR);// ARRAY?
ResultSet rs = cs.executeQuery();
Array array = (Array) rs.getObject (1);
ResultSet array_rset = array.getResultSet ();Not that familiar with the OCI (Oracle Call Interface), but I think this call will be problematic - the OCI deals with SQL data types and not with PL/SQL structures.
The OCI has since Oracle 8i sported an object call interface (see OCI Runtime Environment for Objects for details).
This allows you to use the CREATE TYPE command to create advance user data types - and these are supported by the SQL engine, PL/SQL engine and external languages via the OCI.
So you need to have a look at the Perl-DBI documentation to see how it supports Oracle object types and consider using these. As for internal PL/SQL data structures. These are not supported by the SQL engine and I would expect limited or no support in the OCI for these. Anyway, using SQL data types makes a lot more sense ito flexibility and transparency across languages and environments. -
How to find the number of records per months in cube
Hi,
how to find the number of records per months for my all cubes?
Can i use the ListCube transaction to find totl number f records per cube monthwise ?
JimmyHi,
Here is a program to generate no of records and list of ODS and Cubes in Active version.Schedule this program in background and create a cube to load this information and schedule to the data from the file generated by the program. Schedule this all per you requirement.
1.Copy the code into your Z<programname> from Se38.
2.change the FILENAME in CALL FUNCTION 'GUI_DOWNLOAD' in the program to the location from where you can pick the information to load data to cube(eg Application server).
3.Save program.
4.Schedule the program in background as required
5.Create cube with infoobjects to hold no of records and Infoprovider name
6.Load this cube based on event after the program job is done.
Hence you can report on this cube to see no of records in CUBE or ODS in your box.
Please find the code below.
Cheers,
Kavitha Kamesh.
types: begin of itabs ,
tabname type dd02l-tabname,
end of itabs.
data: itab type itabs occurs 0 with header line.
data: counter type i.
data: begin of itab1 occurs 0,
tabname type dd02l-tabname,
counter type i,
end of itab1.
DATA: ITABTABNAME TYPE STRING.
DATA: LENGTH TYPE I.
DATA: OBJECT(30).
data: str(6) type c.
select tabname from dd02l into table itab where ( tabname LIKE '/BIC/F%' or tabname LIKE '/BIC/A%00' )
and TABCLASS = 'TRANSP' and AS4LOCAL = 'A'.
loop at itab.
select count(*) from (itab-tabname) into counter.
str = itab-tabname.
if str = '/BIC/F'.
LENGTH = STRLEN( ITAB-TABNAME ).
SHIFT itab-tabname BY 6 PLACES LEFT.
ELSEIf str = '/BIC/A'.
SHIFT itab-tabname BY 6 PLACES LEFT.
LENGTH = STRLEN( ITAB-TABNAME ).
LENGTH = LENGTH - 2.
endif.
itab1-tabname = itab-tabname(LENGTH).
append itab1.
itab1-counter = counter.
clear itab-tabname.
clear: COUNTER.
endloop.
*********** itab1
loop at itab1.
write:/ itab1-tabname, itab1-counter.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = 'c:records.xls'
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = ','
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = itab1
* FIELDNAMES =
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
How to find the number of records in ods?
how to find the number of records in ods?
Pls suggest the solution apart going to the table of ods and seeing the number of records.
Is there any program or function module to see the number of records in ods?
For eg: SAP_INFOCUBE_DESIGNS is a program which gives the detail (number of records) of infocube.Hi,
I was looking at this and found the following tables that may be of help.
One of these tables will include a summary of the record count of all the tables in your system based on the last time each table had it's database statistics calculated:
DBSTATTADA
DBSTATTDB2
DBSTATTDB4
DBSTATTDB6
DBSTATTINF
DBSTATTMSS
DBSTATTORA
We run on an Oracle database so the table record counts can be taken from DBSTATTORA. Type in AZ in table selection field in SE16 to restrict the output to ODS (or DSO) tables only.
The record count is at the time indicated in the timestamp field. Obviously this is not real time but should not be too out of date - if it is you may be having performance issues and should get your DBA / Basis to run a full refresh of DB stats.
Hope this helps, alhtough not real time the table should give you a decent indication of the size of all your ODS objects (or any other table for that matter!) -
How to set the number of records displayed at run time
Is it possible to set the number of records displayed block property at run time? The built-in 'GET_BLOCK_PROPERTY' can retrieve the number of RECORDS_DISPLAYED. But I can't find SET_BLOCK_PROPERTY to set this property. Is there anyway I can set this property programmatically? Thanks for any suggestions!
Bookmark Go to End
goal: How to vary the number of records displayed in a block
programmatically
fact: Oracle Forms Developer
fix:
Block property 'Number of Records Displayed' can not be changed during runtime
using SET_BLOCK_PROPERTY. However, it is still possible programmatically change
the visual appearance of the form so that it creates effect of changing this
property. To achieve such an effect follow these steps:
1. in Forms Builder, in the multirecord block define the new set of items.
The simplest way is to copy/paste the original item and rename created item.
2. set properties of these new items so that they are the same as the properties
of the original items. If these new items were copied from original items
then properties are already the same. Modify following properties
'Database item' on new items to value 'No'
'Synchronize with item' to the value of the original item
'Number of Items Displayed' to desired value.
'Visible' to 'No'
In other words, these new items are mirrors of original items.
3. code event, which is meant to trigger the change in block appearance.
This code should use SET_ITEM_PROPERTY built-in to set properties
like 'VISIBLE', 'ENABLED', 'NAVIGABLE', 'UPDATE_ALLOWED' and others
to desired value for items which are about to be displayed, then
move cursor to one of these just displayed items with GO_ITEM built-in
and then hide the previously displayed items.
Example:
Assume that the block is built on SCOTT.DEPT schema. Following will
change the set of displayed items
set_item_property('dept.mdeptno',visible,property_true);
set_item_property('dept.mdname',visible,property_true);
set_item_property('dept.mloc',visible,property_true);
set_item_property('dept.mdeptno',enabled,property_true);
set_item_property('dept.mdname',enabled,property_true);
set_item_property('dept.mloc',enabled,property_true);
set_item_property('dept.mdeptno',update_allowed,property_true);
set_item_property('dept.mdname',update_allowed,property_true);
set_item_property('dept.mloc',update_allowed,property_true);
set_item_property('dept.mdeptno',navigable,property_true);
set_item_property('dept.mdname',navigable,property_true);
set_item_property('dept.mloc',navigable,property_true);
go_item('dept.mdeptno');
set_item_property('dept.deptno',visible,property_false);
set_item_property('dept.dname',visible,property_false);
set_item_property('dept.loc',visible,property_false);
Regards,
Monica -
How to set pdn12.trancat mandatory in this stored procedure?
How can i make PDN12.transcat in this Stored Procedure
USE [zIRC DEMO]
GO
/****** Object: StoredProcedure [dbo].[SP_CHECK_MANDATORY_IN_OPDN] Script Date: 03/07/2014 10:37:54 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[SP_CHECK_MANDATORY_IN_OPDN]
@list_of_cols_val_tab_del NVARCHAR(255), @error_message NVARCHAR(255) OUTPUT
AS
BEGIN
--invoice type
select
@error_message='In header line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND isnull(OPDN.U_InvType,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND isnull(OPDN.U_InvType,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Invoice Type is missing'
-- num at card
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In header line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S','L') AND isnull(OPDN.NumAtCard,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S','L') AND isnull(OPDN.NumAtCard,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Vendor ref. number is missing'
END
-- transporter
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S','L') AND isnull(OPDN.U_Transport,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S','L') AND isnull(OPDN.U_Transport,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Transporter is missing'
END
--dealer
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S','L') AND isnull(OPDN.U_dealer,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S','L') AND isnull(OPDN.U_Dealer,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Dealer is missing'
END
--base price
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S') AND isnull(PDN1.U_BasePrice,0)=0
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S') AND isnull(PDN1.U_BasePrice,0)=0
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Base Price is missing'
END
--taxcode
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S','L') AND isnull(PDN1.TaxCode,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S','L') AND isnull(PDN1.TaxCode,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Taxcode is Missing'
END
-- ed rate
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S') AND isnull(PDN1.U_EDRate,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S') AND isnull(PDN1.U_EDRate,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Excice Duty Rate is missing'
END
-- ed duty
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S') AND isnull(PDN1.U_EDuty,0)=0
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('M','D','S') AND isnull(PDN1.U_EDuty,0)=0
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Excice Duty is missing'
END
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('D','S') AND ISNULL(PDN1.U_MfgInvNo,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('D','S') AND ISNULL(PDN1.U_MfgInvNo,'')=''
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Mfg. invoice number is missing'
END
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('D','S') AND isnull(convert(nvarchar(10),U_MfgInvDt,112),'')=''
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('D','S') AND isnull(convert(nvarchar(10),U_MfgInvDt,112),'')=''
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Mfg. invoice date is missing'
END
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('D','S') AND PDN1.U_MfgQty=0
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('D','S') AND PDN1.U_MfgQty=0
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Mfg. invoice Quantity is missing'
END
if(ISNULL(@error_message,'')='')
BEGIN
select
@error_message='In line number(s), '+ substring
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
where
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('D','S') AND PDN1.U_MfgValue=0
order by
PDN1.LineNum FOR XML PATH ('')
),1
,LEN((
select CONVERT(char(2),PDN1.LineNum)+','
from
OPDN
inner join PDN1 on OPDN.DocEntry=PDN1.DocEntry
WHERE
OPDN.DocEntry=@list_of_cols_val_tab_del AND OPDN.DocType='I' AND OPDN.U_InvType in ('D','S') AND PDN1.U_MfgValue=0
order by
PDN1.LineNum FOR XML PATH ('')
))-1
)+' Mfg. Assessble value is missing'
END
if(ISNULL(@error_message,'')<>'')
BEGIN
return -1
END
else
begin
return 0
end
ENDHello Nabil
Could you explain what is the point of making PDN12.Trancat mandatory? I am asking this because at my end that field has got NULL value in all PDN12 table entries, and I am not sure if this field can be updated manually when creating a Good Receipt PO. Considering this, it seems that by making this field mandatory TN will block all Good Receipts from addition.
Regards -
Insert record using stored procedure
Dear all,
I want to insert record using stored procedure in form6i,
any help or suggestion will be appreciated.
regards
Kashif AliKashif,
Could you please explain what you are trying to accomplish? Inserting records into a table from Forms is as simple as executing an INSERT statement in a Forms trigger or as complicated as overriding the Forms default INSERT functionality by defining your own On-Insert trigger. Your requirements will dictate where and how you do your INSERT.
Craig... -
Hi,
How do I return two values from a
stored procedure into an "Execute SQL Task" please? Each of these two values need to be populated into an SSIS variable for later processing, e.g. StartDate and EndDate.
Thinking about stored procedure output parameters for example. Is there anything special I need to bear in mind to ensure that the SSIS variables are populated with the updated stored procedure output parameter values?
Something like ?
CREATE PROCEDURE [etl].[ConvertPeriodToStartAndEndDate]
@intPeriod INT,
@strPeriod_Length NVARCHAR(1),
@dtStart NVARCHAR(8) OUTPUT,
@dtEnd NVARCHAR(8) OUTPUT
AS
then within the SSIS component; -
Kind Regards,
Kieran.
Kieran Patrick Wood http://www.innovativebusinessintelligence.com http://uk.linkedin.com/in/kieranpatrickwood http://kieranwood.wordpress.com/Below execute statement should work along the parameter mapping which you have provided. Also try specifying the parameter size property as default.
Exec [etl].[ConvertPeriodToStartAndEndDate] ?,?,? output, ? output
Add a script task to check ssis variables values using,
Msgbox(Dts.Variables("User::strExtractStartDate").Value)
Do not forget to add the property "readOnlyVariables" as strExtractStartDate variable to check for only one variable.
Regards, RSingh -
How can I automatically prepend comment blocks to stored procedures?
How can I automatically prepend comment blocks to stored procedures?
In my organization, the standard is to comment all stored procedures with a comment block that looks like this:
/*-- =============================================
-- Created by: <Owner>
-- Created date: 01/08/2012
-- Purpose: Inserts new setting value, code and description
-- Modifications:
-- Modified by: <Owner>
-- Modification date: 01/08/2012
-- Purpose: Inserts new setting value, code and description
-- =============================================*/Thanks.
select * from v$version;
BANNER
Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production Edited by: xDeviates on 01-ago-2012 7:37
Edited by: xDeviates on 01-ago-2012 8:31Hi,
If I want to write a package called pk_fubar, I copy the following script and call it fubar.sql
-- ========== package_name.sql starts here ==========
-- Package_Name.sql
SPOOL &home_dir\package_name.lst
PROMPT . H H EEEE A DDDD
PROMPT . H H E A A D D
PROMPT . HHHHH EEE A A D D
PROMPT . H H E AAAAA D D
PROMPT . H H EEEEE A A DDDD
@@package_name_head
PROMPT . BBBB OOO DDDD Y Y
PROMPT . B B O O D D Y Y
PROMPT . BBBB O O D D Y
PROMPT . B B O O D D Y
PROMPT . BBBB OOO DDDD Y
@@package_name_body
SPOOL OFF
@@package_name_test
-- EXIT
-- ========== package_name_head.sql starts here ==========
CREATE OR REPLACE PACKAGE pk_package_name
AS
FUNCTION sign_in
( in_user_name IN VARCHAR2
, in_password_txt IN VARCHAR2
RETURN PLS_INTEGER
END pk_package_name;
SHOW ERRORS;
GRANT EXECUTE ON pk_package_name TO schema_name_some_role;
-- ========== package_name_body.sql starts here ==========
CREATE OR REPLACE PACKAGE BODY pk_package_name
AS
-- Procedures related to SCHEMA_NAME ...
-- 2012 July 23 -- Package started with proc_x. (Frank Kulash)
-- ** local procedures and variables **
-- ** x **
-- ** initialization section **
-- The following code is executed once per session, when the package is loaded.
BEGIN
set_var ( 'DT_FMT_TXT'
, 'YYYY-MM-DD HH24:MI:SS'
END pk_package_name;
SHOW ERRORS;
-- ========== package_name_test.sql starts here ==========
-- PACKAGE_NAME_TEST.SQL -- Test procedures in schema_name.pk_package_name
SET DOCUMENT OFF
SET SERVEROUTPUT ON SIZE 10000
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-Mon-YYYY HH24:MI:SS';
SPOOL @@package_name_test.lst
PROMPT
PROMPT ***********************
PROMPT ** Testing x **
PROMPT ***********************
PROMPT
SPOOL OFFThen I replace package_name with fubar, and schema_name with the actual schema name. Finally, I cut off parts from the end to create fubar_test.sql, fubar_body.sql and fubar_head.sql. You could easily include a multi-line procedure comment template in this script. Every time you add a procedure or function, ciopy and paste that comment template, and then modify the copy. -
How to find total number of records in a BDoc?
Dear all,
I have replicated about BP 1088 records from ISU into CRM system with block size 100. Technically on SMW01, for each successfully processed BDoc, there will be 100 records (corresponds to 100 block size). But due to some failed BDocs, not all "successfully" BDocs will have 100 records each, some may have only 1 record inside...or 30...or 88 for example. So, may i know how to find or is there a report i can look into to find the total number of records clearly shown for each of the successfully processed green status BDocs???
Please help and points will be rewards!!
Thank You
Best Regards,
CKI am just showing this to show how to get the rowcount along with the cursor, if the program has so much gap of between verifying the count(*) and opening the cursor.
Justin actually covered this, he said, oracle has to spend some resources to build this functionality. As it is not most often required, it does not makes much sence to see it as a built-in feature. However, if we must see the rowcount when we open the cursor, here is a way, but it is little bit expensive.
SQL> create table emp_crap as select * from emp where 1 = 2;
Table created.
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from (select rownum rn, e.ename from emp_crap e) order by 1 desc)
6 loop
7 if v_cnt = 0 then
8 v_cnt := rec.rn;
9 end if;
10 end loop;
11 if v_cnt = 0 then
12 raise zero_rows;
13 end if;
14 exception
15 when zero_rows then
16 dbms_output.put_line('No rows');
17 end;
18 /
No rows
PL/SQL procedure successfully completed.
-- Now, let us use the table, which has the data
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from
6 (select rownum rn, e.ename from emp e)
7 order by 1 desc)
8 loop
9 if v_cnt = 0 then
10 v_cnt := rec.rn;
11 dbms_output.put_line(v_cnt);
12 end if;
13 end loop;
14 if v_cnt = 0 then
15 raise zero_rows;
16 end if;
17 exception
18 when zero_rows then
19 dbms_output.put_line('No rows');
20 end;
21 /
14
PL/SQL procedure successfully completed.Thx,
Sri -
How to calculate the number of records in Multiprovider
Hi Experts
I have created a report based on the multiprovider (Consist of Cube and ODS)
I need count the number of records inside the multiprovider, how can i do it in the reporting level
Regards
SantoshHi,
You can use calculated key figure with replacement path variable.
Follow This:
1) From the context menu of the Key Figure directory, choose New Calculated Key Figure.
2) From the context menu for the Formula Variable, choose New Variable.
3) Choose the Processing type as Replacement Path.
4) In the next screen, select the Characteristic Info Object based on which the number of documents is to be displayed in the report (For example: Document Number / Order Number).
5) Choose Next.
In the Replace Variable with drop down box, choose Attribute Value.
In the Attribute drop down, select Characteristic Reference (Constant 1).
6)Choose Next.
On the Save Variable page, an overview of the settings made for the variable will be displayed.
Confirm the entries and Choose Finish.
7) If the Formula variable is directly assigned to the Calculated Key Figure, a warning Calculated Key Figure is not defined correctly will be displayed while executing the Query.
8) Properties of Calculated Key Figure dialog box, assign a Technical name for the CKF.
9) set the Time of Calculation to After Aggregation.
Hope this will help you.
Cheers,
DK
Edited by: Debasish Khaitan on May 14, 2009 1:03 PM -
How to get the number of records of a streaming result set
Hi guys.
So if it wasn't a streaming result set, I would have done this:
{noformat}myResultSet<code class="jive-code jive-java">.last();
{color:navy}*int*{color} numResults = </code>myResultSet<code class="jive-code jive-java">.getRow();
</code>myResultSet<code class="jive-code jive-java">.beforeFirst();
</code>{noformat}
but being a streaming result set, beforeFirst() throws an exception...
So how do you get the number of records in that result set? I wanna avoid an extra count(*) query, so I would appreciate other solutions than that.JoachimSauer wrote:
vanwil wrote:
you see, for now I just use a count(*) query to get the number of records, but that's adding a lot of extra waiting time...Iterating over the result twice will surely be slower then doing the count(*).great! so what I got now is actually the fastest way there is... awesome...
If you get an exception, then you surely have a stack trace. That should tell you what happens, or at least where.com.mysql.jdbc.MysqlIO.checkForOutstandingStreamingData(MysqlIO.java:2066)
Why do you need to know the number of elements beforehand, anyway?I need to know the number of elements because the incoming data goes into a table. Now of course, I could use ArrayList<String[]> or something, but wouldn't that require more memory resources than Object[][] ?
No one can tell you that, at least not without more information (say, the stack trace for example).Here's the exception message:
java.sql.SQLException: Streaming result set com.mysql.jdbc.RowDataDynamic@10c0ef2 is still active. Only one streaming result set may be open and in use per-connection. Ensure that you have called .close() on any active result sets before attempting more queries. -
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 -
How to set default number of records shown in report table?
How can I set the default number of records shown in a table report?
This is how report attributes page should look like and there is the number of rows where you enter whatever you need:
http://i44.tinypic.com/es95bn.gif
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
How to update unique number to records coming under 1 Hierarchy?
Hi,
I have the below table ,
CREATE TABLE TEMP2
ID NUMBER,
MATCH_ID NUMBER,
UniqueID NUMBER
below records available in the table temp2,
ID MATCH_ID UNIQUEID
1 2
1 3
1 4
2 5
3 7
5 9
10 11
12 13
SET DEFINE OFF;
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(1, 2, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(1, 3, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(1, 4, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(2, 5, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(3, 7, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(5, 9, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(10, 11, NULL);
Insert into TEMP2
(ID, MATCH_ID, UNIQUEID)
Values
(12, 13, NULL);
COMMIT;
requirement :
id 1 is matching with matchID 2,3,4 and 2 is matching with 5 and 3 is matching with 7 and 5 is matching with 9
here I want to give one unique sequnce to all the related hierarchy records,
How can i do this?
my output should like this,
ID MATCH_ID UNIQUEID
1 2 1
1 3 1
1 4 1
2 5 1
3 7 1
5 9 1
10 11 2
12 13 3
Any help appriciated..You want something like this?
SQL> ed
Wrote file afiedt.buf
1 select id, match_id, dense_rank() over (order by par_id) as rnk
2 from (
3 select id, match_id, connect_by_root(id) as par_id
4 from temp2
5 connect by nocycle id = prior match_id
6 -- start with id not in (select match_id from temp2)
7 )
8* order by rnk
SQL> /
ID MATCH_ID RNK
612646357 612663043 1
612663043 612646357 1
612646600 612673275 2
612673275 612646600 2
612646602 612660746 3
612660746 612646602 3
612646816 612661509 4
612661509 612646816 4
612660746 612646602 5
612646602 612660746 5
612661509 612646816 6
612646816 612661509 6
612663043 612646357 7
612646357 612663043 7
612673275 612646600 8
612646600 612673275 8
16 rows selected.
Maybe you are looking for
-
Copying and updating Data from a table to new table using Merge command
Hi , Can anyone please tell me how to do this? I have a table : EMP(empno(pk),ename,sal,dept) another table is EMP_CLASS(empno(pk),ename) I want to insert corresponding rows from emp to emp_class table if that row does'nt exist in emp_class otherwise
-
An error occured on the server while reading settings
Hi to everyone, Today i renewed my server's Profiles Manager Code Signing Certificate following this link http://support.apple.com/kb/HT5358 The certificate was renewed sucessfully for one year. I switched the Profile Manager Off then next to "Sign c
-
Hi all, in my new Mac, I have problem with IMAP mail account. The mail app is still crashing. In My Preferences/Internet Account, I have only this one email account and iCloud. Thanks to anyone who will reply! Ales (Czech Republic). Here is the crash
-
Mac asked me to upgrade to Firefox 8.0 now I can't access anything.
-
Need help on OCI_NONBLOCKING_MODE
Hello all, I set the server handle in OCI_NONBLOCKING_MODE. When I ran OCIStmtExecute, I start checking the status returned by OCIStmtExecute, After around 50 loops of checking, OCIStmtExecute returned OCI_SUCCESS instead of OCIStmtExecute. I used OC