Unable to retrieve the values from stored procedure
Hi all
I written one procedure and when i am trying to invoke that store procedure from jdbc it is throwing the following error .
java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.DelegatingCallableStat
ement
at com.srit.hrnet.helpdesk.grievancemechanism.GrievanceComplaintDAO.getE
mployerGenDetails(GrievanceComplaintDAO.java:895)
at com.srit.hrnet.helpdesk.grievancemechanism.GrievanceComplaintAction.d
eleteComplaints(GrievanceComplaintAction.java:1095)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchActio
n.java:276)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:
196)
at org.apache.struts.action.RequestProcessor.processActionPerform(Reques
tProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
va:226)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:116
4)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
at com.srit.hrnet.filter.SessionValidateFilter.doFilter(SessionValidateF
ilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:684)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at com.srit.hrnet.helpdesk.grievancemechanism.GrievanceComplaintAction.d
eleteComplaints(GrievanceComplaintAction.java:1098)and my code is
store procedure is
============
create or replace procedure SP_HD_GRIEVANCE_DELETE_DETAILS(in_queryid IN number DEFAULT NULL,RC1 IN OUT globalPkg.RCT1)
as
queryId number(18,0);
BEGIN
SP_HD_GRIEVANCE_DELETE_DETAILS.queryId := SP_HD_GRIEVANCE_DELETE_DETAILS.in_queryid;
IF SP_HD_GRIEVANCE_DELETE_DETAILS.queryId = 1 THEN
BEGIN
OPEN RC1 FOR
select HGRMCODE as compcode,emcode as applyEmpId,EMFNAME as assName,designame as desig,deptname as department ,to_char(HGRMOCCRDT,'DD/MM/YYYY') as occdate,
HGRMSLATYPE as category,HGRMSUBCAT as subcat,HGRMSLAPRIORITY as priority,HGRMSTATUS as status from EMP_MSTR,HD_GRIEVANCE_RM_MSTR,
dept_mstr,desig_mstr where EMCODE=HGRMAPPLYEMCODE and EMDEPTCODE=deptcode and desigcode=EMDESIGCODE order by HGRMCODE;
END;
END IF;
END SP_HD_GRIEVANCE_DELETE_DETAILS;and javacode is
==========
con = new DBConnection().getConnection();
java.sql.CallableStatement stmt = con.prepareCall("{call SP_HD_GRIEVANCE_DELETE_DETAILS(?,?)}");
stmt.clearParameters();
stmt.setInt(1,1);
stmt.registerOutParameter(2, OracleTypes.CURSOR);
stmt.execute();
cursor = ((OracleCallableStatement)stmt).getCursor(1);
list = new ArrayList();
while (cursor.next()) {
compTO = new GrievanceComplaintTO();
list.add(compTO);
}where GrievanceComplaintTO is formbean class
Please Guide me.
Thanks in advance.
Obviously, this
cursor = ((OracleCallableStatement)stmt).getCursor(1);fails because you don't get an OracleCallableStatement.
Similar Messages
-
Unable to update the values from store procedure
hi ,
I have simple table with 3 columns. id, name , sal. am updating the salary based on names.
alter PROCEDURE p1(@names varchar(100))
AS
BEGIN
declare @empData varchar(200)
set @empData= '''' + replace(@names,',',''',''')+''''
print @empData
update tmp set sal =10 where name in ( @empData )
END
GO
if I execute same query (update tmp set sal =10 where name in ( @empData )) outside with printed @empData data it is working fine.
why the same is not working with SP ?
any ideas...You need to split the list into a temporary table or table valued variable:
alter PROCEDURE p1(@names varchar(100))
AS
BEGIN
declare @empTable table ([name] varchar(100));
declare @p int = 1;
declare @len int = len(@names);
declare @nextP int = charindex(',', @name, @p) ;
set @nextP = case when @nextP = 0 then @len else @nextP end;
while @p < @len
begin
insert into @empTable
values (substring(@names, @p, @nextP-1));
set @p = @nextP + 1;
Set @nextP int = charindex(',', @name, @p) ;
set @nextP = case when @nextP = 0 then @len else @nextP
end
update tmp
set sal =10
where name in (Select [name] from @empTable );
END
GO
Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com -
Unable to get the values from ISearchResultList
Hi,
I am working on KM Indexmanagemnt API for searching with TREX, to build a search similar to msn or google.
I am following the example of Thilo Brandt, and after building the query, I am unable to retrieve the result from ISearchResultList, the results size its displaying is zero. But session.getTotalNumberResultKeys() is retrieving a value 20.
Here is the code I am using, please tell me where I am doing wrong.
public class SearchComponetOne extends AbstractPortalComponent {
public void doContent(IPortalComponentRequest request, IPortalComponentResponse response) {
com.sap.security.api.IUser nwUser =
UMFactory.getAuthenticator().getLoggedInUser();
com.sapportals.portal.security.usermanagement.IUser user = null;
try {
user = WPUMFactory.getUserFactory().getEP5User(nwUser);
} catch (UserManagementException e) {
response.write(e.getMessage());
response.write("<html><head><title>Search</title></head><body>");
ResourceContext c = new ResourceContext(user);
try {
IIndexService indexService = (IIndexService) ResourceFactory
.getInstance()
.getServiceFactory()
.getService(
IServiceTypesConst.INDEX_SERVICE);
SearchQueryListBuilder sqb = new SearchQueryListBuilder();
sqb.setSearchTerm("sap");
IQueryEntryList qel = sqb.buildSearchQueryList();
// get an instance of federated search
IFederatedSearch federatedSearch =
(IFederatedSearch) indexService.getObjectInstance(
IWcmIndexConst.FEDERATED_SEARCH_INSTANCE);
List indexList = new ArrayList();
String index = null;
if (index != null && index.length() > 0) {
// take a specified index from index= parameter
indexList.add(indexService.getIndex(index));
} else {
// take all available indexes
indexList = indexService.getActiveIndexes();
// it is recommended to use a search session object
// for searching execution
ISearchSession session = null;
if (session == null)
session = federatedSearch.searchWithSession(qel, indexList, c);
response.write("Inside doContent session.getNumberResultKeys() => " + session.getNumberResultKeys()); // output as 20
this.renderResultHeader(response, session, indexList);
// get all results from the search session
ISearchResultList results = session.getSearchResults(1, session.getTotalNumberResultKeys());
response.write(" from session => " + results.size() + " and size is : " + results.toString()); // I am getting the results.size() as zero
ThanksI think the problem is UME related. I had the same problem once. Try using a system user for searching, instead of the logged on user.
Like this:
com.sapportals.portal.security.usermanagement.IUser user = WPUMFactory.getUserFactory().getUser("cmadmin_service");
Please reward the points if this helps. -
How to retrieve the values from PL/SQL table types.
Hi Every one,
I have the following procedure:
DECLARE
TYPE t1 IS TABLE OF emp%ROWTYPE
INDEX BY BINARY_INTEGER;
t t1;
BEGIN
SELECT *
BULK COLLECT INTO t
FROM emp;
END;
This procedure works perfectly fine to store the rows of employee in a table type. I am not able to retrieve the values from Pl/SQL table and display it using dbms_output.put_line command.
Can anybody help me please!!!!!
Thanks
Ahmed.You mean, you can't add this
for i in t.first..t.last loop
dbms_output.put_line(t(i).empno||' '||t(i).ename||' '||t(i).job);
end loop;or you can't add this
set serveroutput onor maybe, you are working in third party application where dbms_output is not applicable at all?
You see, not able like very similar it is not working - both are too vague...
Best regards
Maxim -
How to retrieve the values from a table if they differ in Unit of Measure
How to retrieve the values from a table if they differ in Unit of Measure?
If no data is read
- Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
If no quanity in result internal table
- There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
- - Remove the CORRESPONDING, so quantity will fill the first field adqntp1. ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
- - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
* Fill the internal table
SELECT msehi adqntp
INTO TABLE internal table
FROM lipso2
WHERE vbeln = wrk_doc1
AND msehi IN ('KL','K15','MT').
* If required move the read quantity in the appropriate column.
LOOP AT internal_table ASSIGNING <fs>.
CASE <fs>-msehi.
WHEN 'K15'.
<fs>-adqnt2 = <fs>-adqnt1.
CLEAR <fs>-adqnt1.
WHEN 'MT'.
<fs>-adqnt3 = <fs>-adqnt1.
CLEAR <fs>-adqnt1.
ENDCASE.
ENDLOOP.
- You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
Regards,
Raymond -
Copy values from stored procedure to a text pad
Any Suggestions
We have a table 'A' and wrote a select query to get the values from that table 'A'. I place this select query in Stored procedure and when I run that procedure every month the output should be sent t a text pad. Any suggestions how to write it
thanks
Is there any other method if we dont have the privelage to create directory?
Edited by: user646635 on Oct 2, 2008 7:16 AMuser646635 wrote:
want to store the output in a text file?
we are using oracle 9iHere's a basic example for you...
AS SYS:
create or replace directory TEST_DIR as 'c:\test_dir'; -- This creates an oracle directory object. The actual operating system directory must be created manually
grant read,write on directory test_dir to my_user; -- Grant permission to use that directory object to the required user(s)AS my_user:
declare
cursor cur_emp is
select ename, deptno
from emp;
v_fh UTL_FILE.FILE_TYPE; -- This is a file handle
begin
v_fh := UTL_FILE.FOPEN('TEST_DIR', 'file.txt', 'w', 32767); -- Open the file for writing and obtain a handle to it
FOR i IN cur_emp -- process the query in a loop
LOOP
UTL_FILE.FPUT_LINE(v_fh, i.ename||','||to_char(i.deptno,'fm099')); -- write out lines of text to the file
END LOOP;
UTL_FILE.FCLOSE(v_fh); -- Close the file (also flushes any unwritten buffered data).
end; -
How to get return values from stored procedure to ssis packge?
Hi,
I need returnn values from my stored procedure to ssis package -
My procedure look like and ssis package .Kindly help me to oget returnn value to my ssis package
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [TSC]
-- Add the parameters for the stored procedure here
@P_STAGE VARCHAR(2000)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
--SELECT <@Param1, sysname, @p1>, <@Param2, sysname, @p2>
truncate table [INPUTS];
INSERT
INTO
[INPUTS_BASE]
SELECT
[COLUMN]
FROM [INPUTS];
RETURN
END
and i am trying to get the return value from execute sql task and shown below
and i am taking my returnn value to result set variableYou need to have either OUTPUT parameters or use RETURN statement to return a value in stored procedures. RETURN can only return integer values whereas OUTPUT parameters can be of any type
First modify your procedure to define return value or OUTPUT parameter based on requirement
for details see
http://www.sqlteam.com/article/stored-procedures-returning-data
Once that is done in SSIS call sp from Execute SQL Task and in parameter mapping tabe shown above add required parameters and map them to variables created in SSIS and select Direction as Output or Return Value based on what option you used in your
procedure.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
How to output value from stored procedure
Hi folks, I need to output the OrderFK from a stored procedure not really sure how to achieve this any help or tips much appreciated.
Sql code below
USE [TyreSanner]
GO
/****** Object: StoredProcedure [dbo].[AddCustomerDetails] Script Date: 11/12/2014 20:56:34 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[AddCustomerDetails]
/***********************Declare variables ***********************/
/******tblCustomer******/
@Forename nvarchar(50),
@Surname nvarchar(50),
@HouseNo nvarchar(50),
@CustAddress nvarchar(50),
@Town nvarchar(50),
@Postcode nvarchar(50),
@ContactNo nvarchar(50),
@EmailAddress nvarchar(50),
/******tblLink_OrderProduct******/
@ProductQuantity int,
@TotalProductSaleCost decimal,
@ProductFK int,
@FittingDate date,
@FittingTime Time
As
DECLARE @CustomerFK int;
DECLARE @OrderFK int;
Begin TRANSACTION
SET NOCOUNT ON
INSERT INTO [TyreSanner].[dbo].[Customer](Forename, Surname, HouseNo, CustAddress, Town, Postcode, ContactNo, EmailAddress)
VALUES (@Forename,@Surname,@HouseNo,@CustAddress,@Town,@Postcode,@ContactNo,@EmailAddress)
Set @CustomerFK = SCOPE_IDENTITY()
INSERT INTO [TyreSanner].[dbo].[Order] (CustomerFK)
VALUES (@CustomerFK)
SET @OrderFK = SCOPE_IDENTITY()
INSERT INTO [TyreSanner].[dbo].[Link_OrderProduct](OrderFK, ProductFK, ProductQuantity, TotalProductSaleCost, FittingDate, FittingTime)
VALUES
(@OrderFK, @ProductFK, @ProductQuantity, @TotalProductSaleCost, @FittingDate, @FittingTime)
COMMIT TRANSACTIONHi brucey54,
There’re several ways to capture the value from a Stored Procedure. In you scenario, I would suggest 2 options, by an output parameter or by a table variable.
By an output Parameter, you need to make a little bit modification on your code as below:
USE [TyreSanner]
GO
ALTER PROCEDURE [dbo].[AddCustomerDetails]
@Forename nvarchar(50),
@FittingDate date,
@FittingTime Time,
@OrderFK int output
As
DECLARE @CustomerFK int;
--DECLARE @OrderFK int;
Run the following code, Then @OrderFKvalue holds the value you’d like.
DECLARE @OrderFKvalue int;
EXEC AddCustomerDetails(your parameters,@OrderFKvalue output)
Anyway if you don’t like to add one more parameter, you can get the value by a table variable as well. Please append “SELECT @OrderFK;” to your Procedure as below:
USE [TyreSanner]
GO
ALTER PROCEDURE [dbo].[AddCustomerDetails]
SET @OrderFK = SCOPE_IDENTITY()
INSERT INTO [TyreSanner].[dbo].[Link_OrderProduct](OrderFK, ProductFK, ProductQuantity, TotalProductSaleCost, FittingDate, FittingTime)
VALUES
(@OrderFK, @ProductFK, @ProductQuantity, @TotalProductSaleCost, @FittingDate, @FittingTime);
SELECT @OrderFK;
Then you can call the Stored Procedure as below:
DECLARE @T TABLE (OrderFK INT);
INSERT @T EXEC AddCustomerDetails(your parameters) ;
SELECT OrderFK FROM @T;
There’re more options to achieve your requirement, please see the below link:
How to Share Data between Stored Procedures
If you have any question, feel free to let me know.
Best Regards,
Eric Zhang -
How to retrieve the values from a LinkedList
Hello,
I have just put this question in java programming forums by mistake...I think that it should be here ...
I have created a LinkedList to store the results of a query to a database.
These reasults are decimal numbers and then I want to sum all these numbers to be able to make the average.
But when I try to retrieve the values of the Linked List I always receive an incopatible types error..
Here is an extract of my code in a jsp page.
LinkedList Average = new LinkedList();
String Media = rst.getString(10);
Average.add(Media);
int Size = Average.size();
double Sum = 0.0;
for (int i=0; i<=Size; i++)
double Result = Average.get(i)
Sum = Sum + Result;
}If I try to retrieve the value of only one node from the list , I can just putting <%=Average.get(i)%>...but..how can I retrieve all the values (they are decimal numbers) to be able to add them?If you want to sum all the values, is there any reason you just don't retrieve the sum from the database rather than the list of values?
anyway
List average = new LinkedList();
while (rst.next()){
// retrieve the number:
String mediaString = rst.getString(10);
Double media = Double.valueOf(mediaString);
// or maybe like this if it is a number in the database
Double media = new Double(rst.getDouble(10));
average.add(media);
doubleSum = 0.0;
for (Iterator it = average.iterator(); it.hasNext(); ){
Double result= (Double) it.next();
doubleSum += result.doubleValue();
} -
How to capture return value from stored procedure?
Hi All,
I want to capture the retun values from this procedure to a table - CALL SYS.GET_OBJECT_DEFINITION('SCHEMA_NAME', 'TABLE_NAME').
The below approach is not working -
Insert into STG.STG_DDL
Call SYS.GET_OBJECT_DEFINITION('DWG', 'DWG_SITE')
Could you please have a look on the same?
Thank you,
VijeeshThanks a lot Everyone.
Considering the discussed options, and an approach explained in this thread - -http://scn.sap.com/thread/3291461 , I have written an SQL to build the Alter statements to add the columns & Constrains to table.
The below Query will provide the scripts to build a table in another environment.
select * from (
select TABLE_name,'tbl_Create' column_name, 1 as position, 'CREATE TABLE '|| schema_name ||'.'|| table_name ||' ( DUMMY_CLMN INTEGER);' as SQLCMD
from tableS
where schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
UNION ALL
-- MASS change of NOT NULL COLUMNS
-- set to NOT NULL - character data type, double, decimal fixed - need the length but not the scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'FALSE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('VARCHAR', 'NVARCHAR', 'DOUBLE')
and scale is NULL
UNION ALL
-- MASS change of NOT NULL COLUMNS
-- set to NOT NULL - character data type, double, decimal fixed - need the length but not the scale
select TABLE_name,column_name, position + 100,'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') );' as SQLCMD
from table_columns
where is_nullable = 'TRUE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('VARCHAR', 'NVARCHAR', 'DOUBLE')
and scale is NULL
UNION ALL
-- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||','|| scale ||') NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'FALSE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DECIMAL' )
and scale is not null
UNION ALL
-- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||','|| scale ||') ) ;' as SQLCMD
from table_columns
where is_nullable = 'TRUE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DECIMAL' )
and scale is not null
UNION ALL
-- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and null scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'FALSE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DECIMAL' )
and scale is null
UNION ALL
-- set to NOT NULL - DECIMAL (FLOATING POINT)- needs length and null scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' (' || length ||') NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'TRUE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DECIMAL' )
and scale is null
UNION ALL
-- set to NOT NULL - DATE | TIME | SECONDDATE | TIMESTAMP | TINYINT | SMALLINT | INTEGER - don't need length or scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' NOT NULL) ;' as SQLCMD
from table_columns
where is_nullable = 'FALSE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DATE', 'LONGDATE', 'TIME', 'SECONDDATE', 'TIMESTAMP', 'TINYINT', 'SMALLINT', 'INTEGER' )
-- and scale is not null
UNION ALL
-- set to NOT NULL - DATE | TIME | SECONDDATE | TIMESTAMP | TINYINT | SMALLINT | INTEGER - don't need length or scale
select TABLE_name,column_name, position + 100, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' ADD ('||column_name ||' '||data_type_name ||' ) ;' as SQLCMD
from table_columns
where is_nullable = 'TRUE'
and schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
and data_type_name in ('DATE', 'LONGDATE', 'TIME', 'SECONDDATE', 'TIMESTAMP', 'TINYINT', 'SMALLINT', 'INTEGER' )
-- and scale is not null
UNION ALL
select table_name, 'PK' AS column_name, 9990, 'ALTER TABLE '||table_name||' ADD CONSTRAINT Primary_key PRIMARY KEY ('||PK_COLUMN_NAME1||
case when PK_COLUMN_NAME2 is null then ' ' else ','|| PK_COLUMN_NAME2 end ||
case when PK_COLUMN_NAME3 is null then ' ' else ','|| PK_COLUMN_NAME3 end ||
case when PK_COLUMN_NAME4 is null then ' ' else ','|| PK_COLUMN_NAME4 end ||');'
from
(SELECT DISTINCT C1.table_name , C1.COLUMN_NAME AS PK_COLUMN_NAME1, C2.COLUMN_NAME AS PK_COLUMN_NAME2, C3.COLUMN_NAME AS PK_COLUMN_NAME3, C4.COLUMN_NAME AS PK_COLUMN_NAME4
FROM (SELECT * FROM CONSTRAINTS WHERE POSITION=1 AND IS_PRIMARY_KEY = 'TRUE') C1
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=2 AND IS_PRIMARY_KEY = 'TRUE') C2
ON C1.table_name = C2.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=3 AND IS_PRIMARY_KEY = 'TRUE') C3
ON C2.table_name = C3.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=4 AND IS_PRIMARY_KEY = 'TRUE') C4
ON C3.table_name = C4.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=5 AND IS_PRIMARY_KEY = 'TRUE') C5
ON C4.table_name = C5.table_name
) PK
where table_name = 'DWG_PRODUCTION_VOLUME_TRX'
UNION ALL
select table_name, 'UK' AS column_name, 9991, 'ALTER TABLE '||table_name||' ADD CONSTRAINT UNIQUE ('||UK_COLUMN_NAME1||
case when UK_COLUMN_NAME2 is null then ' ' else ','|| UK_COLUMN_NAME2 end ||
case when UK_COLUMN_NAME3 is null then ' ' else ','|| UK_COLUMN_NAME3 end ||
case when UK_COLUMN_NAME4 is null then ' ' else ','|| UK_COLUMN_NAME4 end ||');'
FROM
(SELECT DISTINCT C1.table_name , C1.COLUMN_NAME AS UK_COLUMN_NAME1, C2.COLUMN_NAME AS UK_COLUMN_NAME2, C3.COLUMN_NAME AS UK_COLUMN_NAME3, C4.COLUMN_NAME AS UK_COLUMN_NAME4
FROM (SELECT * FROM CONSTRAINTS WHERE POSITION=1 AND IS_PRIMARY_KEY = 'FALSE') C1
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=2 AND IS_PRIMARY_KEY = 'FALSE') C2
ON C1.table_name = C2.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=3 AND IS_PRIMARY_KEY = 'FALSE') C3
ON C2.table_name = C3.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=4 AND IS_PRIMARY_KEY = 'FALSE') C4
ON C3.table_name = C4.table_name
LEFT JOIN (SELECT * FROM CONSTRAINTS WHERE POSITION=5 AND IS_PRIMARY_KEY = 'FALSE') C5
ON C4.table_name = C5.table_name
) UK
where table_name = 'DWG_PRODUCTION_VOLUME_TRX'
UNION ALL
SELECT REFERENCED_TABLE_NAME AS table_name,'FK' AS column_name, 9992,
'ALTER TABLE DWG.'||TABLE_NAME||' ADD FOREIGN KEY ( '||COLUMN_NAME||' ) REFERENCES '|| REFERENCED_TABLE_NAME||'('||COLUMN_NAME||' ) ON UPDATE CASCADE ON DELETE RESTRICT;'
FROM REFERENTIAL_CONSTRAINTS
WHERE REFERENCED_TABLE_NAME = 'DWG_SITE'
UNION ALL
select TABLE_name,'tbl_ClmnDrop' column_name, 9995 as position, 'ALTER TABLE '|| schema_name ||'.'|| table_name ||' DROP ( DUMMY_CLMN );' as SQLCMD
from tableS
where schema_name ='DWG'
and TABLE_name ='DWG_PRODUCTION_VOLUME_TRX'
order by position; -
Unable to get the values from PAYLOAD
Hi,
i'm unable to get the values of payload. When i use
currentTask = client.getTaskQueryService().getTaskDetailsById(workflowContext, taskID);
Element payload = (Element)currentTask.getPayloadAsElement();
node = (Element)payload.getFirstChild();
System.out.println(node.getElementsByTagName("documentName").item(0).getNodeValue());
I get null but i instantiate the bpel process with a value and i have
- <payload>
- <ns1:DocumentReviewProcessRequest xmlns:ns1="http://xmlns.oracle.com/bpel/Review">
<ns1:documentTitle>vbvnmbvn</ns1:documentTitle>
<ns1:documentName>bvnbvnvn</ns1:documentName>
<ns1:URI>http://www.first.pt</ns1:URI>
<ns1:assignees>gestdoc</ns1:assignees>
<ns1:groups />
</ns1:DocumentReviewProcessRequest>
</payload>
if i use System.out.println(node.getElementsByTagName("HELLO").item(0).getNodeValue());
I get a normal erro 'cause this variable don't exist...
Can someone please help me?
Thanks!!I think the problem is UME related. I had the same problem once. Try using a system user for searching, instead of the logged on user.
Like this:
com.sapportals.portal.security.usermanagement.IUser user = WPUMFactory.getUserFactory().getUser("cmadmin_service");
Please reward the points if this helps. -
Unable to get the value from the textfield in valueChangeEvent
Hi,
I have created one custom textField by extending the CoreInputText. Now i have attched default ValueChangeListener to it. I am using this textField in my application.
Now i type some thing and do a focus lost, the value change listener get called. i want to validate the value entered. In that listener method if i take the getSource() from ValueChnageEvent object and do a getValue() I am getting the entered value.
My problem is that if i do a getValue() of the textField i am not gettting the value entered.
How can i get the entered value from the textfield.? Is there any method to notify to do this?
Thanks in advance.Hi,
I tried to the value from coreInputText also. If i check the getValue method of the component, i am getting the last updated value. I have debug the FlowPhaseListsner also. And i found that this listener is calling before the updateModel phase. Due to that i am not getting the value from the Field. -
Storing the values from a procedure - help required
Hi All,
I am having a package which consists of two procedures.
Both the procedures need to calculate 6 averages of some of my fields based on unique number.
(These two procedures process different unique numbers).
Now, as same code is implemented in the two procedures for calculation,
I want to move the logic into another procedure/function, with IN parameter as the unique number.
Now how can I get these 6 values from the procedure.
If I use OUT parameters, how can I get the values inside the procedure.
Please suggest me a solution.
Thanks in advance.
Regards
RaghunadhExample of pipelined function...
SQL> CREATE OR REPLACE TYPE myrec AS OBJECT
2 ( col1 VARCHAR2(10),
3 col2 VARCHAR2(10)
4 )
5 /
Type created.
SQL>
SQL> CREATE OR REPLACE TYPE myrectable AS TABLE OF myrec
2 /
Type created.
SQL>
SQL> CREATE OR REPLACE FUNCTION pipedata(p_str IN VARCHAR2) RETURN myrectable PIPELINED IS
2 v_str VARCHAR2(4000) := REPLACE(REPLACE(p_str, '('),')');
3 v_obj myrec := myrec(NULL,NULL);
4 BEGIN
5 LOOP
6 EXIT WHEN v_str IS NULL;
7 v_obj.col1 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
8 v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
9 IF INSTR(v_str,',')>0 THEN
10 v_obj.col2 := SUBSTR(v_str,1,INSTR(v_str,',')-1);
11 v_str := SUBSTR(v_str,INSTR(v_str,',')+1);
12 ELSE
13 v_obj.col2 := v_str;
14 v_str := NULL;
15 END IF;
16 PIPE ROW (v_obj);
17 END LOOP;
18 RETURN;
19 END;
20 /
Function created.
SQL>
SQL> create table mytab (col1 varchar2(10), col2 varchar2(10));
Table created.
SQL>
SQL> insert into mytab (col1, col2) select col1, col2 from table(pipedata('(1,2),(2,3),(4,5)'));
3 rows created.
SQL>
SQL> select * from mytab;
COL1 COL2
1 2
2 3
4 5Although I'm not sure you necessarily need to do it this way. Could you show us the code you are using and more details of what you are trying to do? -
Get out values from stored procedure
Hi folks,
I have need of an aid. I have created this stored procedure:
CREATE OR REPLACE PROCEDURE ProceduraDiProva (
p_val1 IN NUMBER DEFAULT 1,
p_val2 IN NUMBER DEFAULT 1,
p_val3 OUT NUMBER,
p_val4 OUT NUMBER)
AS
BEGIN
p_val3 := p_val1 + p_val2;
p_val4 := 999;
END ProceduraDiProva;
I call the procedure into shell script
$ORACLE_HOME/bin/sqlplus -s user/pwd@oracleid > oracle.log << END
spool ciccio.txt
declare
var a_out number;
var b_out number;
begin
var a_out:=0;
exec ProceduraDiProva(1, 2, a_out, b_out);
end;
spool off;
exit
END
I would know as I make to insert 'a_out' and 'b_out' in a shell variables
Tanks in advanceI found an example with windows
Create a file cmd with;
FOR /F "usebackq delims=!" %%i IN (`sqlplus -s %usuario%/%pwd%@%ddbb% @1.sql`) DO set xresult=%%i
echo %xresult%
And the 1.sql:
set timing off
set feedback off
set pages 0
select sysdate from dual;
exit
------------------------------------------------------------------------------------------ -
Why iam unable to get the valu from combobox
when i run this code
everytime iam getting blank alert
y iam unable to get the selected item from combo box
thank u
<%@ page import="java.util.Date"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%><%@page import="java.sql.*,java.util.*,java.text.*,java.util.ArrayList, java.util.List,org.joda.time.DateTimeConstants,org.joda.time.LocalDate,
org.joda.time.Weeks"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>Reading Data From Text Fields</TITLE>
</HEAD><BODY onload=Datevalue()>
<form name="form1" action ="" method="post" onSubmit="update();">
<img src="nendrasys_logo.gif" align="right"></img>
<b><font color="669900"><h4 align="left">UserName:</font>
<jsp:useBean id="user" scope="session" class="nendrasys.User" />
<jsp:getProperty name="user" property= "name"/>
    
<b><font color="90be00"><h4 align="left">Designation:</font>
<jsp:getProperty name="user" property= "designation"/>
<br><font color="669900"><h4 align="right">Project:</font>
<select name="Projects">
<option>Project:1</option>
<option>Project:2</option>
<option>Project:3</option>
<option>Project:4</option>
<option>Project:5</option>
</select>
<%! String s; %>
<% DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Date date = new Date();
//out.println(dateFormat.format(date));
s= dateFormat.format(date);
%>
<select name="Dates" sizes=1 id="dates" onchange="Datevalue(this.value)">
<script type="text/javascript">
<!--//
var begDate = new Date("10/01/2008");
var endDate = new Date();
var previousDate =new Date();
var presentDate =new Date("<%=s %>");
endDate.setDate(presentDate.getDate()+14);
begDate.setDate(begDate.getDate()+(6-begDate.getDay()));
while (begDate <= endDate) {
var datestring=[begDate.getDate(),(begDate.getMonth()+1),begDate.getFullYear()].join('/');
// var datestring=[begDate.getDate().padZero(2),(begDate.getMonth()+1).padZero(2),begDate.getFullYear()].join('/');
if(previousDate < presentDate && presentDate <= begDate )
document.writeln('<option selected>'+(datestring)+'</option>')}
else
document.writeln('<option>'+(datestring)+'</option>')};
previousDate.setDate(begDate.getDate());
previousDate.setMonth(begDate.getMonth());
previousDate.setYear(begDate.getYear());
begDate.setDate(begDate.getDate()+7);
document.writeln('</select>');
//-->
</script>
<br><br>
<TABLE BORDER="2" BORDERCOLOR="#336699" CELLPADDING="2" CELLSPACING="2" WIDTH="100%">
<TR>
<TD>   </TD>
<TD bgcolor="669900"><label id="sun"></label></TD>
<TD bgcolor="90be00"><label for="mon" id="Mon">Mon</label></TD>
<TD bgcolor="669900"><label for="tue" id="tue">Tue</label></TD>
<TD bgcolor="90be00"><label for="wed" id="wed">Wed</label></TD>
<TD bgcolor="669900"><label for="thu" id="thu">Thu</label></TD>
<TD bgcolor="90be00"><label for="fri" id="fri">Fri</label></TD>
<TD bgcolor="669900"><label for="sat" id="sat">Sat</label></TD>
<TD bgcolor="90be00"><label for="tot" id="tot">Total</label></TD>
</TR>
<tr>
<th>Project Work</th>
<td bgcolor="669900"><input type="text" name="c11" size="2" value="7" onBlur="javascript:document.frm.c12.value = document.frm.c11.value"></td>
<td bgcolor="90be00"><input type="text" name="c12" size="2" value="3"></td>
<td bgcolor="669900"><input type="text" name="c13" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c14" size="2"></td>
<td bgcolor="669900"><input type="text" name="c15" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c16" size="2"></td>
<td bgcolor="669900"><input type="text" name="c17" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c18" size="4"></td>
</tr>
<tr>
<th>Internal N/C</th>
<td bgcolor="669900"><input type="text" name="c21" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c22" size="2"></td>
<td bgcolor="669900"><input type="text" name="c23" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c24" size="2"></td>
<td bgcolor="669900"><input type="text" name="c25" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c26" size="2"></td>
<td bgcolor="669900"><input type="text" name="c27" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c28" size="4"></td>
</tr>
<tr>
<th>Public Holidays</th>
<td bgcolor="669900"><input type="text" name="c31" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c32" size="2"></td>
<td bgcolor="669900"><input type="text" name="c33" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c34" size="2"></td>
<td bgcolor="669900"><input type="text" name="c35" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c36" size="2" ></td>
<td bgcolor="669900"><input type="text" name="c37" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c38" size="4"></td>
</tr>
<tr>
<th>Holidays Taken</th>
<td bgcolor="669900"><input type="text" name="c41" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c42" size="2"></td>
<td bgcolor="669900"><input type="text" name="c43" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c44" size="2"></td>
<td bgcolor="669900"><input type="text" name="c45" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c46" size="2"></td>
<td bgcolor="669900"><input type="text" name="c47" size="2"></td>
<td bgcolor="90be00"><input type="text" name="c48" size="4"></td>
</tr>
</TABLE>
<br>
<center><input type="submit" value="Submit" /> </center>
<%
String username = request.getParameter("userid");
String pwd = request.getParameter("pwd");
String connectionURL = "jdbc:mysql://localhost:3306/timestamp";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
String sql=null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "root","nendrasys");
statement = connection.createStatement();
//rs=statement.executeQuery(sql); %>
</form>
<SCRIPT language='Javascript'>
function update()
alert("ciaoooooo");
<%
try
String value=request.getParameter("c11");
String value1=request.getParameter("c12");
// if(value!=null)
// System.out.println(value);
// System.out.println(value1);
catch(NullPointerException n)
%>
</script>
<SCRIPT language='Javascript'>
function Datevalue(date)
// document.getElementById("dates").innerHTML=document.getElementById("sun").value;
alert(date);
// alert( document.getElementById("dates"))
<% System.out.println("bye");%>
</SCRIPT>
</BODY>
</HTML>You mixed Java and Javascript in the expectation that they runs simultaneously.
You are Wrong.
You need to distinguish between the server side languages and client side languages. Java/JSP runs at the server side and produces a HTML page with other client side stuff in it like CSS and Javascript. When the HTML page is finished, it will be sent to the client and then Java/JSP stops. Once the HTML page is arrived at the client, there is no one line Java code in it, only its output/result. Do a View Source in your favourite web browser to see it. Only from that moment on, Javascript runs and/or can be invoked.
Whenever you want to use Java variables in Javascript, you need to print them out as a Javascript variable. Whenever you want to use Javascript variables in Java, you need to invoke a request to the server and pass them as parameters. The request can be either synchronous (a link or a form submit) or asynchronous (ajaxical).
Maybe you are looking for
-
JVM CRASH with the error msg An unexpected error has been detected by HotS
Iam using Jboss 4.2.2 for my application the JVM is crashing with the following msg when i call a function in a DLL (JNI) the error msg : # An unexpected error has been detected by HotSpot Virtual Machine: # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at
-
Upgrading to Vista on MacBook Pro
Just curious to know if the Window's side of the MacBook pro I just bought is upgradeable to Microsoft's Vista OS when it's finally available. Anybody know? macbook pro Mac OS X (10.4.8)
-
BUG No Toplink with HSQLDB support
1. Start HSQLDB in server mode 2. Log in as SA 3. Create two tables (in public schema, which is the default) with parent-child relation 4. Create new schema, switch to new schema 5. Create two tables (in public schema, which is the default) with pare
-
My sister-in-law has been using a high end Sony video camera for 12 years to make videos of birds. She started with an iMac and moved to an eMac and now is looking to upgrade to a new desktop with iMovie HD. Unfortunately, her old Sony 720 camera is
-
Hi, I am wondering if it is possible to use existing Includes (e.g. constants) in global classes as well. I don't want to create the same constants again and have double maintenance. Is there any trick to point e.g. new class-constants to the existin