Is their anything wrong with this stored procedure?
CREATE PROCEDURE [dbo].[DeleteAllUserReferences]
@UserName NVARCHAR(256),
@Id NVARCHAR(128),
@Role NVARCHAR(256),
@RowsAffected int OUTPUT
AS
BEGIN TRY
/*Declare @RowsAffected int;*/
EXEC aspnet_UsersInRoles_RemoveUsersFromRoles "mainwebsite",@UserName,@Role
EXEC aspnet_Users_DeleteUser "mainwebsite",@UserName,15,@RowsAffected
DELETE FROM [AspNetUserRoles] WHERE UserId = @Id
DELETE FROM [AspNetUsers] WHERE UserName = @UserName
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
END CATCH
RETURN 0
I have a stored procedure above which executes fine when I execute it manually but does not when I execute it via asp.net. Only the first statement executes and the rest does not. Is their anything that might not be proper SQL in this code causing it to stop
functioning properly?
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering
- Yoda. Blog - http://www.computerprofessions.co.nr
Since I don't know anything about the contents in that procedure I cannot comment on it. But if an error occurred, you would be taken the CATCH block and the error would be reraised.
Erland Sommarskog, SQL Server MVP, [email protected]
Here's the code you requested:
CREATE PROCEDURE [dbo].aspnet_Users_DeleteUser
@ApplicationName nvarchar(256),
@UserName nvarchar(256),
@TablesToDeleteFrom int,
@NumTablesDeletedFrom int OUTPUT
AS
BEGIN
DECLARE @UserId uniqueidentifier
SELECT @UserId = NULL
SELECT @NumTablesDeletedFrom = 0
DECLARE @TranStarted bit
SET @TranStarted = 0
IF( @@TRANCOUNT = 0 )
BEGIN
BEGIN TRANSACTION
SET @TranStarted = 1
END
ELSE
SET @TranStarted = 0
DECLARE @ErrorCode int
DECLARE @RowCount int
SET @ErrorCode = 0
SET @RowCount = 0
SELECT @UserId = u.UserId
FROM dbo.aspnet_Users u, dbo.aspnet_Applications a
WHERE u.LoweredUserName = LOWER(@UserName)
AND u.ApplicationId = a.ApplicationId
AND LOWER(@ApplicationName) = a.LoweredApplicationName
IF (@UserId IS NULL)
BEGIN
GOTO Cleanup
END
-- Delete from Membership table if (@TablesToDeleteFrom & 1) is set
IF ((@TablesToDeleteFrom & 1) <> 0 AND
(EXISTS (SELECT name FROM sysobjects WHERE (name = N'vw_aspnet_MembershipUsers') AND (type = 'V'))))
BEGIN
DELETE FROM dbo.aspnet_Membership WHERE @UserId = UserId
SELECT @ErrorCode = @@ERROR,
@RowCount = @@ROWCOUNT
IF( @ErrorCode <> 0 )
GOTO Cleanup
IF (@RowCount <> 0)
SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1
END
-- Delete from aspnet_UsersInRoles table if (@TablesToDeleteFrom & 2) is set
IF ((@TablesToDeleteFrom & 2) <> 0 AND
(EXISTS (SELECT name FROM sysobjects WHERE (name = N'vw_aspnet_UsersInRoles') AND (type = 'V'))) )
BEGIN
DELETE FROM dbo.aspnet_UsersInRoles WHERE @UserId = UserId
SELECT @ErrorCode = @@ERROR,
@RowCount = @@ROWCOUNT
IF( @ErrorCode <> 0 )
GOTO Cleanup
IF (@RowCount <> 0)
SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1
END
-- Delete from aspnet_Profile table if (@TablesToDeleteFrom & 4) is set
IF ((@TablesToDeleteFrom & 4) <> 0 AND
(EXISTS (SELECT name FROM sysobjects WHERE (name = N'vw_aspnet_Profiles') AND (type = 'V'))) )
BEGIN
DELETE FROM dbo.aspnet_Profile WHERE @UserId = UserId
SELECT @ErrorCode = @@ERROR,
@RowCount = @@ROWCOUNT
IF( @ErrorCode <> 0 )
GOTO Cleanup
IF (@RowCount <> 0)
SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1
END
-- Delete from aspnet_PersonalizationPerUser table if (@TablesToDeleteFrom & 8) is set
IF ((@TablesToDeleteFrom & 8) <> 0 AND
(EXISTS (SELECT name FROM sysobjects WHERE (name = N'vw_aspnet_WebPartState_User') AND (type = 'V'))) )
BEGIN
DELETE FROM dbo.aspnet_PersonalizationPerUser WHERE @UserId = UserId
SELECT @ErrorCode = @@ERROR,
@RowCount = @@ROWCOUNT
IF( @ErrorCode <> 0 )
GOTO Cleanup
IF (@RowCount <> 0)
SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1
END
-- Delete from aspnet_Users table if (@TablesToDeleteFrom & 1,2,4 & 8) are all set
IF ((@TablesToDeleteFrom & 1) <> 0 AND
(@TablesToDeleteFrom & 2) <> 0 AND
(@TablesToDeleteFrom & 4) <> 0 AND
(@TablesToDeleteFrom & 8) <> 0 AND
(EXISTS (SELECT UserId FROM dbo.aspnet_Users WHERE @UserId = UserId)))
BEGIN
DELETE FROM dbo.aspnet_Users WHERE @UserId = UserId
SELECT @ErrorCode = @@ERROR,
@RowCount = @@ROWCOUNT
IF( @ErrorCode <> 0 )
GOTO Cleanup
IF (@RowCount <> 0)
SELECT @NumTablesDeletedFrom = @NumTablesDeletedFrom + 1
END
IF( @TranStarted = 1 )
BEGIN
SET @TranStarted = 0
COMMIT TRANSACTION
END
RETURN 0
Cleanup:
SET @NumTablesDeletedFrom = 0
IF( @TranStarted = 1 )
BEGIN
SET @TranStarted = 0
ROLLBACK TRANSACTION
END
RETURN @ErrorCode
END
Sorry, about the delay. If you think this helps then I will finally be able to finish my stored procedure and move on.
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to
suffering - Yoda. Blog - http://www.computerprofessions.co.nr
Similar Messages
-
What is the problem with this Stored Procedure
Hi ,
What is the problem with this Stored Procedure ?Why is it giving errors ??
CREATE or replace PROCEDURE getEmpName
*(EMP_FIRST OUT VARCHAR2(255))*
BEGIN
SELECT ename INTO EMP_FIRST
FROM Emp
WHERE EMPNO = 7369;
END ;
*/*You don't specify precision in procedure arguments.
(EMP_FIRST OUT VARCHAR2(255))should be
(EMP_FIRST OUT VARCHAR2)Since you asked what's wrong with it, I could add that it needs formatting and the inconsistent use of upper and lower case is not helping readability. -
Do you see anything wrong with this GL mapping in a cube?
hi,
Can you verify if something is wring with this mapping:
In model 1:
0fi_gl_4 --> 0figl_O02 --> 0figl_C02
the standard cube shows the following key figures and I mapped them to the following fields from the datasource:
DMSOL(in datasource) to 0Debit_LC (in DSO) to 0Debit (in cube)
DMHAB(in datasource) to 0Credit_LC (in DSO) to 0Credit (in cube)
In model 2:
0fi_gl_6 --> 0figl_C01
the standard cube shows the following key figures and I mapped them to the following fields from the datasource:
UMSOL(in datasource) to 0Debit (in cube)
UMHAB(in datasource) to 0Credit (in cube)
1. Do you see anything wrong with this mapping? And what is the solution?
2. What is the problem with the mapping if both cubes sit under the same multiprovider, since 0debit and 0credit are from differnt souce fields?
thnxHi,
Thanks for the explanation.
on #1,
if my goal is to provide a sort of trial balance, credits and debits as two columns, will it be ok to assume that it should be Local Currency or could it be Document Currency, Local Currency 2 or Local Currency 3? If the latter, then how do I decide?
on #2,
i. why will there be difficulty creating a union between the two?
ii. will there also be an inconsistency if I created 2 separate multiproviders for each model, and create a jump query from the 0fi gl_6 model to 0fi gl_c4 model. If not, why not in this case?
iii. So, is there any advantage in placing a multiprovider on each of these models separately? i.e. instead of directly reporting off the cubes separately?
3. I am wondering why in the case of gl_6 (the totals) help.sap recomended to go directly from the datasource to the cube i.e. without DSO in between.
If without the DSO step is an advantage, what are the advantages?
And why then do we use DSOs in most model instead? I will appreciate any reasons you may think of..
Thnx.
Edited by: AmandaBaah on Jul 28, 2009 11:07 AM
Edited by: AmandaBaah on Jul 29, 2009 2:25 AM -
I have purchased a 'adobe font folio 11'.
The ci in this font was made.
Is there anything wrong with this post copyright if the Web site?These machines in themselves are usually pretty good, with the occasional aberration. Let's hope you do not have a rogue.
Looking at the problems there seem to me (as a guess) two problems: incomplete processes and memory. The two may be related. The camera problem I would dismiss as simply that -- batteries run out and the Mac is trying to complete an impossible process: expecting data, data never arrives.
The Firefox problem may be something external: a badly coded page; something the browser (or Mac) was not equipped to handle (a plug-in for example) and this could put a strain on RAM.
Maya, I am not familiar with, but it is (if I remember rightly) graphics-oriented and that can be memory intensive).
Which all comes down to the RAM you bought. Without knowing what it is or where it came from, or your experience in installing it, that in itself could be a problem. You need to make sure that it is properly seated for one thing, that it is the correct type (although the information here suggests that you are on the right track) and that it is OK.
You might also want to think about posting a crash log here (find these in Console) as someone -- not me -- might be able to pinpoint a cause. -
Is anything wrong with this part of my code?
Hi all,
I am making a program with lots of methods inside the one class
whenever I call this method it stuffs up... it may be the way I call it or it may be the code is wrong.... could u please tell me if there is an error in the code or if this section is ok?
public static int seatSearch(String[][] reservation, String target)
// cycle through the array
for (int i = 0; i < reservation.length; i++)
// if the target is found, return the index
if (reservation[0] == target)
System.out.println("found at [" + i + "][0]");
return i;
// if it finished the loop and still hasn't returned anything
// then return -1 to signal the data wasn't found
System.out.println("the data was not found!");
return -1;
oh yeh... it compiles but when I call it it always returns -1 even when its meant to return the index...
Thanks,
Mikedo some defensive coding and check for nulls,
put some printlnwhat do u mean?
If you have a NullPointer Exception, then your code has a reference variable that does not point to an object.
If the exception comes from the code you posted, either the target variable, the reference variable, or one of the contents of the reference array must be null. To determine which it is, put a System.out.println(target+"\t"+reservation; at the start of the method and put a System.out.println(i+"\t"+reservation[0]); as the first line in the for loop. When your run the code, it will display null somewhere - and that's what you have to fix.
My guess is you have null references in the reservation array and you must decide what to do with those in your code. For exampleif (reservation[0] != null && reservation[i][0].equals(target)) -
Wht's wrong with this stream procedure.????
Am running this procedure and this is giving me an error..."wrong number or type of arguments to the call.."
declare
tab_array dbms_utility.uncl_array;
begin
tab_array(0) := 'scot.emp';
tab_array(1) := 'scot.dept';
dbms_streams_adm.maintain_tables(
table_name => tab_array,
source_directory_object => 'c:\oracle\kndl_src_strm_dir',
destination_directory_object => 'c:\oracle\kndl_dst_strm_dir',
source_database => 'twus',
destination_database => 'twuk',
perform_action => true,
caoture_name => 'Stream_Capture',
apply_name => 'Stream_Apply',
bidirectional => false,
instantiation => dbms_streams_adm.instantiation_table_network
end;
PLease help!!
Kapiltoo manny spelling mistakes of arguments......
am sorry guys for inconvenience...
Kapil -
Anything wrong with this repo?
following the beginners guide on wiki, doing the rankmirror
It says my best option is
mirror.neotuli.net
second best is
homes.umflint.edu
third is
ftp.archlinux.org
4th
mrrors.easynew.com
I am in USA, Oklahoma
any suggestions.If it's fast for you with rankmirror, generally choose the order that it gives.
This great website gives status updates on current mirrors. -
Anybody see anything wrong with this syntax ?
I tried to compile the following, but tells me there is an else without an if :
import javax.swing.JOptionPane;
class Test {
public static void main (String[] args) {
String response;
int togo = 0;
response = JOptionPane.showInputDialog ("What is your age?");
if (response == null)
JOptionPane.showMessageDialog
(null, "You clicked on the Cancel button");
else
if (response.equals (""))
JOptionPane.showMessageDialog
(null, "You must make an entry");
else
if ((Integer.parseInt(response)) < 65)
togo = (65 - (Integer.parseInt(response)));
JOptionPane.showMessageDialog
(null, "You have " + togo + " years to go until
retirement");
else
JOptionPane.showMessageDialog
(null, "You are already able to retire");
System.exit (0);import javax.swing.JOptionPane;
class Test {
public static void main (String[] args) {
String response;
int togo = 0;
response = JOptionPane.showInputDialog ("What is your age?");
if (response == null) { // -- Whenever you have more than one line of commands, you must enclose your statements with braces
JOptionPane.showMessageDialog
(null, "You clicked on the Cancel button");
} else if (response.equals ("")) { // same problem
JOptionPane.showMessageDialog
(null, "You must make an entry");
} else if ((Integer.parseInt(response)) < 65) {// same problem
togo = (65 - (Integer.parseInt(response)));
JOptionPane.showMessageDialog
(null, "You have " + togo + " years to go until
retirement");
} else { // same problem
JOptionPane.showMessageDialog
(null, "You are already able to retire");
System.exit (0);
} // close that last else statement
when you have more than one statement for your if i.e.
if ( condition ) {
statement 1;
statement 2;
} else if ( condition2 ) {
statement 1;
statement 2;
} else {
hope that this helped -
Help: Anything wrong with this spatial query?
The error messages are as follows:
SELECT * FROM M_RGSERVERDB1 WHERE sdo_relate(M_RGSERVERDB1.geometry, mdsys.sdo_geometry(2003,NULL,NULL,mdsys.sdo_elem_info_array 1,1003,3),mdsys.sdo_ordinate_array(-97.3 ,35.1 , -97.1 , 35.3)),'mask=COVERS querytype=window') = 'TRUE'
java.sql.SQLException: ORA-06509: PL/SQL: ICD vector missing for this package
ORA-06512: at "JZHANG.MD", line 1723
ORA-06512: at "JZHANG.MDERR", line 8
ORA-06512: at "JZHANG.SDO_3GL", line 57
ORA-06512: at line 1
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:889)
at oracle.jdbc.driver.OracleStatement.doExecuteQuery(OracleStatement.jav
a:1681)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStateme
nt.java:1870)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:
538)
at
TestSpatial.main(TestSpatial.java:60)
nullHi, Jean-Marc:
Thanks very much for your help. However, I don't think I missed the parenthesis after I double-checked it-- maybe due to copy/paste.
In fact, SQLPLUS will remind me if I miss a parenthesis. The following is the SQL that casuse the problem.
SELECT * FROM M_RGSERVERDB1 WHERE sdo_relate(M_RGSERVERDB1.geometry, mdsys.sdo_geometry(2003,NULL,NULL,mdsys.sdo_elem_info_array (1,1003,3),mdsys.sdo_ordinate_array(-97.3 ,35.1 , -97.1 , 35.3)),'mask=COVERS querytype=window') = 'TRUE';
Do you have any ideas on version compatibility of 8.1.7 and 8.1.6 which might casue the problem?
Thanks.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Jean-Marc Prevost ([email protected]):
You have a missing opening parenthesis just after mdsys.sdo_elem_info_array.
You have:
mdsys.sdo_elem_info_array 1,1003,3)
You should have:
mdsys.sdo_elem_info_array (1,1003,3)
Hope this helps!<HR></BLOCKQUOTE>
null -
Anything Wrong with this query?
I have been trying to create a report based on this query:
SELECT call_type.call_type_detail,
code_city.code_city_detail, area_code.area_code_detail,
call_reason.call_reason_detail, cform.cform_phone_number_body,
call_outcome.call_outcome_detail,
outcome_reason.outcome_reason_detail, cform.cform_date_time ,
cform.cform_comments
FROM call_type, code_city, area_code, call_reason, cform,
call_outcome, outcome_reason
I have verified all fields to make sure they match and when I
try to test it CFR crashes...any idea as to why this may be
happening? Thanks!The funny thing is I WAS using inner join already, but didn't
know it was called that and didn't add it to the post since I have
quite a few variables as criteria and thought it would make it
difficult to understand. In the end it was stalling because of an
error in a table I had not properly specified.
This is what I had from the start!
SELECT call_type.call_type_detail,
code_city.code_city_detail, area_code.area_code_detail,
call_reason.call_reason_detail, cform.cform_phone_number_body,
call_outcome.call_outcome_detail,
outcome_reason.outcome_reason_detail, cform.cform_date_time ,
cform.cform_comments
FROM call_type, code_city, area_code, call_reason, cform,
call_outcome, outcome_reason
WHERE cform.cform_date_time BETWEEN
#CreateODBCDateTime(param.CustomFullStartDate)# AND
#CreateODBCDateTime(param.CustomFullEndDate)# AND
cform.cform_call_product=#param.GetCustomProduct# AND
cform.call_service= #param.GetCustomService# AND
cform.cform_call_reason=#param.GetCustomCallReason# AND
cform.cform_call_outcome=#param.GetCustomCallOutcome# AND
cform.cform_call_outcome_reason=#param.GetCustomReason# AND
call_type.call_type_id=cform.cform_call_type AND
call_city.call_city_id=cform.cform_call_city AND
area_code.area_code_id=cform.cform_area_code AND
call_reason.call_reason_id=cform.cform_call_reason AND
call_outcome.call_outcome_id=cform.cform_call_outcome AND
outcome_reason.outcome_reason_id=cform.cform_outcome_reason AND
cform.cform_date_time -
What's wrong with my store procedure?
HI, I can't figure out what's wrong with my stored procedure. I believe i have a "commit;" where it's not supposed to be. What i really want to acheive is save the record once it finds those keywords. Maybe my syntax is all wrong.
I am getting the following error msg. PLS-00103
create or replace
procedure sp_diag is
DECLARE
v_setting_key NUMBER(18);
v_parent NUMBER(22);
v_name VARCHAR2(100);
v_class_key NUMBER(22);
CURSOR c1 IS
select setting_key, setting_class_key,name
from cms2wire.setting_list;
CURSOR c2 IS
select setting_class_key, parent_class_key,name
from cms2wire.setting_class
where setting_class_key = v_parent;
BEGIN
OPEN c1;
LOOP
FETCH c1 into v_setting_key, v_parent, v_name;
EXIT when c1%NOTFOUND;
WHILE v_parent != null
LOOP
OPEN c2;
FETCH c2 into v_class_key, v_parent, v_name;
CLOSE c2;
IF v_name='Diag.'or v_name='Settings.' THEN
COMMIT;
END IF;
END LOOP;
END LOOP;
CLOSE c1;
END;
-------------------------------------------------------------------------------------Now, the way I see it, if you want to save the information, then you need to put it some place, so your slow-by-slow stored procedure becomes something like
INSERT INTO some_table (column list)
SELECT a.setting_key,
a.setting_class_key,
a.name
b.setting_class_key,
b.parent_class_key,
b.name
FROM cms2wire.setting_list a,
cms2wire.setting_class b
WHERE a.setting_class_key = a.setting_class_key
AND b.name in ('Diag.', 'Settings.');
COMMIT;does it not? -
Need Help With a Stored Procedure
Help With a Stored Procedure
Hi everyone.
I am quite new relative to creating stored procedures, so I anticipate that whatever help I could get here would be very much helpful.
Anyway, here is my case:
I have a table where I need to update some fields with values coming from other tables. The other tables, let us just name as tblRef1, tblRef2 and tblRef3. For clarity, let us name tblToUpdate as my table to update. tblToUpdate has the following fields.
PlanID
EmployeeIndicator
UpdatedBy
CreatedBy
tblRef1, tblRef2 and tblRef3 has the following fields:
UserName
EmpIndicator
UserID
In my stored procedure, I need to perform the following:
1. Check each row in the tblToUpdate table. Get the CreatedBy value and compare the same to the UserName and UserID field of tblRef1. If no value exists in tblRef1, I then proceed to check if the value exists in the same fields in tblRef2 and tblRef3.
2. If the value is found, then I would update the EmployeeIndicator field in tblToUpdate with the value found on either tblRef1, tblRef2 or tblRef3.
I am having some trouble writing the stored procedure to accomplish this. So far, I have written is the following:
CREATE OR REPLACE PROCEDURE Proc_Upd IS v_rec NUMBER;
v_plan_no tblToUpdate.PLANID%TYPE;
v_ref_ind tblToUpdate.EMPLOYEEINDICATOR%TYPE;
v_update_user tblToUpdate.UPDATEDBY%TYPE;
v_created_by tblToUpdate.CREATEDBY%TYPE;
v_correct_ref_ind tblToUpdate.EMPLOYEEIDICATOR%TYPE;
CURSOR cur_plan IS SELECT PlanID, EmployeeIndicator, UPPER(UpdatedBy), UPPER(CreatedBy) FROM tblToUpdate;
BEGIN
Open cur_plan;
LOOP
FETCH cur_plan INTO v_plan_no, v_ref_ind, v_update_user, v_created_by;
EXIT WHEN cur_plan%NOTFOUND;
BEGIN
-- Check if v_created_by has value.
IF v_created_by IS NOT NULL THEN
-- Get the EmpIndicator from the tblRef1, tblRef2 or tblRef3 based on CreatedBy
SELECT UPPER(EmpIndicator)
INTO v_correct_ref_ind
FROM tblRef1
WHERE UPPER(USERNAME) = v_created_by
OR UPPER(USERID) = v_created_by;
IF v_correct_ref_ind IS NOT NULL THEN
-- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
ELSIF
-- Check the Other tables here????
END IF;
ELSIF v_created_by IS NULL THEN
-- Get the EmpIndicator based on the UpdatedBy
SELECT UPPER(EmpIndicator)
INTO v_correct_ref_ind
FROM tblRef1
WHERE UPPER(USERNAME) = v_update_user
OR UPPER(USERID) = v_created_by;
IF v_correct_ref_ind IS NOT NULL THEN
-- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
ELSIF
-- Check the Other tables here????
END IF;
END IF;
END;
END LOOP;
CLOSE cur_plan;
COMMIT;
END
Please take note that the values in the column tblToUpdate.UpdatedBy or tblToUpdate.CreatedBy could match either the UserName or the UserID of the table tblRef1, tblRef2, or tblRef3.
Kindly provide more insight. When I try to execute the procedure above, I get a DATA NOT FOUND ERROR.
Thanks.Ah, ok; I got the updates the wrong way round then.
BluShadow's single update sounds like what you need then.
I also suggest you read this AskTom link to help you see why you should choose to write DML statements before choosing to write cursor + loops.
In general, when you're being asked to update / insert / delete rows into a table or several tables, your first reaction should be: "Can I do this in SQL?" If you can, then putting it into a stored procedure is usually just a case of putting the sql statement inside the procedure header/footers - can't really get much more simple than that! *{;-) -
What's wrong with this IF / ELSE statement? ASP/VBScript
Hi,
I'm trying to display a section, within an ASP page, where
the customer
logged in is the same as the customer who placed the order,
identified by
their "customerID".
<%IF (rsUser.Fields.Item("customerID").Value) =
"(rsOrderDetails.Fields.Item("& customerID
&").Value)" Then%>
Text etc...
<%Else%>
Other text etc...
<%End IF%>
The customerID in both database tables is a "bigint" type,
but when I try
the above, I get: "Type Mismatch"?
I've tried this:
<%IF (rsUser.Fields.Item("customerID").Value) =
(rsOrderDetails.Fields.Item("& customerID &").Value)
Then%>
Text etc...
<%Else%>
Other text etc...
<%End IF%>
But this also produces a Type Mismatch error.
Anything glaringly obviously wrong with this? Much
appreciated.
Nath.Thanks Dooza, that's sorted it.
Why does ASP not recognise that they are the same format?
Appreciate the help.
Regards
Nath.
"Dooza" <[email protected]> wrote in message
news:[email protected]...
> Ok, it looks like you will need to convert them to the
same format, even
> if ASP doesn't think they are the same.
>
> <%IF cstr(rsUser.Fields.Item("customerID").Value) =
> cstr(rsOrderDetails.Fields.Item("customerID").Value)
Then%>
> Text etc...
> <%Else%>
> Other text etc...
> <%End IF%>
>
> That converts both to a string, which should evaluate
against each other.
>
> See if that helps.
>
> Steve
>
> tradmusic.com wrote:
>> Sorry Steve,
>>
>> I forgot to remove those from the last example. It
should have read:
>>
>> <%IF (rsUser.Fields.Item("customerID").Value) =
>> (rsOrderDetails.Fields.Item("customerID").Value)
Then%>
>> Text etc...
>> <%Else%>
>> Other text etc...
>> <%End IF%>
>>
>> ....which still doesn't work. :o)
>>
>> Type Mismatch, yet both fields are bigint.
>>
>> Any idea's where the problem is? Much appreciated.
>> Nath.
>>
>>
>> "Dooza" <[email protected]> wrote in
message
>> news:[email protected]...
>>> tradmusic.com wrote:
>>>> Hi,
>>>>
>>>> I'm trying to display a section, within an
ASP page, where the customer
>>>> logged in is the same as the customer who
placed the order, identified
>>>> by their "customerID".
>>>>
>>>> <%IF
(rsUser.Fields.Item("customerID").Value) =
>>>> "(rsOrderDetails.Fields.Item("&
customerID &").Value)" Then%>
>>>> Text etc...
>>>> <%Else%>
>>>> Other text etc...
>>>> <%End IF%>
>>>>
>>>> The customerID in both database tables is a
"bigint" type, but when I
>>>> try the above, I get: "Type Mismatch"?
>>>>
>>>> I've tried this:
>>>>
>>>> <%IF
(rsUser.Fields.Item("customerID").Value) =
>>>> (rsOrderDetails.Fields.Item("&
customerID &").Value) Then%>
>>>> Text etc...
>>>> <%Else%>
>>>> Other text etc...
>>>> <%End IF%>
>>>>
>>>> But this also produces a Type Mismatch
error.
>>>>
>>>> Anything glaringly obviously wrong with
this? Much appreciated.
>>> Whats with this?
(rsOrderDetails.Fields.Item("& customerID &").Value)
>>> Why are there ampersands in there?
>>>
>>> It should be just this:
(rsOrderDetails.Fields.Item("customerID").Value)
>>>
>>> Steve
>> -
So I'm going to college next year, and I need a new computer. I'm going into Architecture, so I need a more powerful machine, and this looks like to be it. But before I buy it...
Is there anything wrong with it?
Any defects, or things to be aware of?
Do you think they'll be any changes with the it between now and July?
Anything will help, thanks!hello,
like all computers, the MacBook Pro "may" have problems, and a quick review of these boards might point to some serious issues with OS X 10.5 and the MBP hardware. But keep in mind that Apple fans are very serious about disseminating their issues on these forums, and that the overwhelming majority of users that do not write here should be assumed to be happy with their purchase (happy people don't write on forums about being happy with their machines, generally).
I have had 5 Apple computers over the last 3 years, 3 macbooks and 2 macbook pros, I need the raw power for my work and my gaming interests, and to be honest, it's not cheap. But you get quality in ways of consistency of performance, ergonomics (usability), integrity of software, very low odds of getting issues like viruses, crashes, etc., and lots of nice eye-candy and frivolous features.
I love my Apple products. I used PC systems running mostly DOS, Windows, and Linux over the last 25 years, and I have no doubts that I will stick to Macs for the next few years at the very least.
I highly recommend the MacBook Pro, get the 15 inches entry-level machine in the Pro series if you have budget issues, they are pricey. It comes with no less functionalities than the other two upper models, and you should be able to even get a discount on the Education Store (or from any Apple Store with student ID). I also recommend the AppleCare extended coverage, I only took it as I also got a discount on the plan (I'm still in university eheh), and while I was skeptical, 3 years of warranty far outweighs the additional cost (for students at least).
I also recommend the bluetooth mouse that Apple sells, it's much more useful and precise than a touchpad, particularly for your architecture endeavors. If you can, max out the RAM by buying it from a 3rd party, Apple sells ridiculously overpriced RAM as upgrades. I started with 2 GB, and paid 100$ more to go to 4 GB (as opposed to 1000$ from Apple).
One warning: if you don't need it now, wait until right before your school starts, buying a little later might get you an updated version of any Apple computer, as they tend to upgrade without warning once or twice a year. If you are not familiar with OS X, try it before you start your school projects though, you might split hair if you are unfamiliar with the basic commands and tricks of the operating system. You can also install Windows XP and or Vista with little difficulty in order to run most industry software that is not compatible with OS X, either natively (install Windows on its own partition on the hard disk), or as a virtualization (slower but convenient), or both.
If you have any other questions, feel free to ask.
Cheers,
Dr Sly -
What's wrong with this SQL?
what's wrong with this SQL?
Posted: Jan 16, 2007 9:35 AM Reply
Hi, everyone:
when I insert into table, i use the fellowing SQL:
INSERT INTO xhealthcall_script_data
(XHC_CALL_ENDED, XHC_SWITCH_PORT, XHC_SCRIPT_ID, XHC_FAX_SPECIFIED)
VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N'
FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION
SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT, HH_SCRIPT,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
I always got an error like;
VALUES (SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS'), HH_SWITCHPORT,
ERROR at line 3:
ORA-00936: missing expression
but I can't find anything wrong, who can tell me why?
thank you so much in advance
mpowel01
Posts: 1,516
Registered: 12/7/98
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:38 AM in response to: jerrygreat Reply
For starters, an insert select does not have a values clause.
HTH -- Mark D Powell --
PP
Posts: 41
From: q
Registered: 8/10/06
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:48 AM in response to: mpowel01 Reply
Even I see "missing VALUES" as the only error
Eric H
Posts: 2,822
Registered: 10/15/98
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:54 AM in response to: jerrygreat Reply
...and why are you doing a UNION on the exact same two queries?
(SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE' UNION SELECT TO_DATE(HH_END_DATE||' '||HH_END_TIME,'MM/DD/YY HH24:MI:SS') ,HH_SWITCHPORT ,HH_SCRIPT ,'N' FROM tmp_healthhit_load WHERE HH_SCRIPT !='BROCHURE');
jerrygreat
Posts: 8
Registered: 1/3/07
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:55 AM in response to: mpowel01 Reply
Hi,
thank you for your answer, but the problem is, if I deleted "values" as you pointed out, and then execute it again, I got error like "ERROR at line 3:
ORA-03113: end-of-file on communication channel", and I was then disconnected with server, I have to relogin SQLplus, and do everything from beganing.
so what 's wrong caused disconnection, I can't find any triggers related. it is so wired?
I wonder if anyone can help me about this.
thank you very much
jerry
yingkuan
Posts: 1,801
From: San Jose, CA
Registered: 10/8/98
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 9:59 AM in response to: jerrygreat Reply
Dup Post
jerrygreat
Posts: 8
Registered: 1/3/07
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 10:00 AM in response to: Eric H Reply
Hi,
acturlly what I do is debugging a previous developer's scipt for data loading, this script was called by Cron work, but it never can be successfully executed.
I think he use union for eliminating duplications of rows, I just guess.
thank you
jerry
mpowel01
Posts: 1,516
Registered: 12/7/98
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 10:03 AM in response to: yingkuan Reply
Scratch the VALUES keyword then make sure that the select list matches the column list in number and type.
1 insert into marktest
2 (fld1, fld2, fld3, fld4, fld5)
3* select * from marktest
UT1 > /
16 rows created.
HTH -- Mark D Powell --
Jagan
Posts: 41
From: Hyderabad
Registered: 7/21/06
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 10:07 AM in response to: jerrygreat Reply
try this - just paste the code and give me the error- i mean past the entire error as it is if error occurs
INSERT INTO xhealthcall_script_data
(xhc_call_ended, xhc_switch_port, xhc_script_id,
xhc_fax_specified)
SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
hh_switchport, hh_script, 'N'
FROM tmp_healthhit_load
WHERE hh_script != 'BROCHURE'
UNION
SELECT TO_DATE (hh_end_date || ' ' || hh_end_time, 'MM/DD/YY HH24:MI:SS'),
hh_switchport, hh_script, 'N'
FROM tmp_healthhit_load
WHERE hh_script != 'BROCHURE';
Regards
Jagan
jerrygreat
Posts: 8
Registered: 1/3/07
Re: what's wrong with this SQL?
Posted: Jan 16, 2007 11:31 AM in response to: Jagan Reply
Hi, Jagan:
thank you very much for your answer.
but when I execute it, I still can get error like:
ERROR at line 1:
ORA-03113: end-of-file on communication channel
so wired, do you have any ideas?
thank you very muchAnd this one,
Aother question about SQL?
I thought I already told him to deal with
ORA-03113: end-of-file on communication channel
problem first.
There's nothing wrong (syntax wise) with the query. (of course when no "value" in the insert)
Maybe you are looking for
-
Hi, I am trying to invalidate the resultcache in OSB. As we don't know the correct format of key structure, I tried with using filters. Below is my client code to invalidate the Resultcache package com.service; import java.util.Set; import com.tangos
-
ODI Reverse Views Issue...
Hi All, We are connecting to schema 'A' on an Oracle db using ODI and trying to access/reverse engineer views from schema 'B'. These are private views and schema 'A' has select permissions on the private views on schema B. we are able to see and quer
-
2515 Locking FMs to Enqueue/Dequeue/ Which one to use?
I know this question is redundant, and has been responded to a million times....all differently. However, being their are 2,515 function modules to choose from, what are the best choices for locking and unlocking a custom database table? And, why are
-
I cannot load music onto my iTunes
Hey all, I have read the previous threat on troubleshooting ( my itunes wont load music). I have follwed all the steps, but my itunes wont load the music. Before, I upgraded to the new itunes the very same files were on my itunes, not only certain so
-
Skip validation - component design question
i've made my own component. in renderer.encode it outputs link, like: <A onclick="document.forms['_id0']['_id0:_id27'].value='field2'; document.forms['_id0'].submit(); " href="#"> it handles this action on it's own, in renderer.decode. my problem is,