VBScript, OracleOLEDB, Procedures
I am attempting to run a VBScript that will perform a set of actions on an Oracle 9i Database through OracleOLEDB. The INSERT statement works fine, but when I try to exec the stored procedure I get an error. ORA-00900: Invalid SQL Statement. The code is:
'----Create User Entry in System----
strWrite = "INSERT INTO security_users (userid, fullname, email, isactive) VALUES ('" & userID & "', '" & fname & "', '" & email & "', '" & isActive & "')"
objConn.Execute(strWrite)
'----Execute Procedure to Populate User----
strCreate = "EXEC create_user('" & userID & "')"
objConn.Execute(strCreate)
I have done a msgbox on the code and it presents the exec statement exactly as intended and I have done an ethereal trace on the network and the statement appears to be sent to the DB correctly as well. Any thoughts on why I might be getting this error? Thanks very much.
tom
Code is not well defined. Many unnecessary lines.
What is it you want to do? What are your errors?
I am pretty sure that MSWinsck.ocx has been discontinued.
The control works with VB6. VB6 controls are only licensed to VB6 applications they are not stand alone. If you install an old VB6 application that uses the control it will be installed. This is not recommended for many reasons including
security reasons. Proceed at your own risk.
¯\_(ツ)_/¯
Similar Messages
-
Call a Vbscript from a stored procedure
Hi,
I wonder is it possible to call a Vbscript from a stored procedure, any good reference for this.
thanksWell here is quick and dirty example I just created.
Step 1. Create a test_batch.bat file that creates a folder "c:\test_dir" and copy "c:emp.lst" into it.
C:\oracle102\examples\test_batch.bat
md c:\test_dir
copy c:\emp.lst c:\test_dir
Step2. From SQLPLUS, spool scott.emp into c:\emp.lst and call the batch from the dbms_scheduler that kicks off right away,
set echo off
set feedback off
spool c:\emp.lst;
select * from scott.emp;
spool off;
begin
dbms_scheduler.create_job(job_name => 'run_batch',
job_type => 'EXECUTABLE',
job_action => 'C:\oracle102\examples\test_batch.bat',
start_date => sysdate,
enabled => true,
comments => 'Run VB Script');
end;
Check if the directory is created and if the file is copied over. Task is to kick off the executable and test is the VBscript within the batch. Challenge is how long the script runs before the next statement in the PL/SQL runs. May be you have to introduce sleep in between.
Note: You must have at least "CREATE JOB" privilege.
Happy coding!
Prakash
Message was edited by:
Prakash Rai -
Export to excel with javascript/vbscript or with plsql(html table)
i have searched for a way to export data from OracleXe to excel without losing formatting .
So far i have found 2 possible relatively easy ways that i am still researching
(i do not include the ask tom sylk format way of exporting )
1 to export the query to a html table, while using stylesheets for formatting
(using microsoft specific styles)
2. use of javascript/vbscript to fill an array and write this array to excel with use
of visual basic for applications in excel.This also provides charting capabilities.
I am still researching this two ways, and have
encountered a few obstacles (help would be appreciated)
1 the first way:
a. create a button " export to excel"
b. create the following pl/sql procedure:
owa_util.mime_header('application/vnd.ms-excel');
owa_util.http_header_close;
HTP.PRINT('<html>');
HTP.PRINT('<head>');
HTP.PRINT('<meta http-equiv="Content-Type" content="text/html">');
HTP.PRINT('<title>Title of the HTML File</title>');
HTP.PRINT('</head>');
HTP.PRINT('<body TEXT="#000000" BGCOLOR="#FFFFFF">');
HTP.PRINT('<h1>Heading in the HTML File</h1>');
HTP.PRINT('<p>Some text in the HTML file.');
HTP.PRINT('</body>');
HTP.PRINT('</html>');
htmldb_application.g_page_text_generated := true;
htmldb_application.g_unrecoverable_error := true;
c: run the procedure conditionally based on the button "export to excel"
the problem with this way is that using htmldb_application.g_unrecoverable_error := true; is not the ideal way, because it
stops further processing, but if i leave it out, the export doesn't happen.
To export to excel while retaining data formatting you have to use microsoft excel
specific styles(Seedocumentation on the microsoft site)
2.The second way:
a create a pl/sql procedure or sql query.
b use this query to fill a vbscript/javascript array with values
c write these values to excel with use of vba in excel :
the obstacle i encountered here was that i dont know how to export the result of a
query to a visual basic script or javascript array.Using approach 1) works fine for me.
the problem with this way is that using htmldb_application.g_unrecoverable_error := true;
is not the ideal way, because it
stops further processing, but if i leave it out, the export doesn't happen. Why is this a problem?
I created the button to export the excel file on page 1 and created your pl/sql procedure on page 2 using an onload process.
Works fine.
Other approaches for exporting to excel are:
http://www.oracle.com/technology/pub/articles/saternos_broadcast.html
http://htmldb.oracle.com/pls/otn/f?p=18326:54:5685133631021176591::::P54_ID:1962
~Dietmar. -
How to use stored procedures in DIAdem and Can the stored procedures be used to return values?
Can anyone please tell me how to use stored procedures in diadem and to return values from it. Its really important, can you please answer it at the earliest.
Thanks In advance
spiyaHi Spria,
I'm very sorry for the mix-up, I thought Allen was going to answer you back with the particulars that we found out. Check out the attached Word document and the below tidbits:
The built-in DIAdem ODBC functions {SQL_...()} can only call stored functions, which return a scaler result {found then in SQL_Result(1,1)}. The syntax for this with an ORACLE db is
"select function(parameters) from package"
...where package defaults to "dual" if you don't use your own package.
There might be exceptions to that though, and the syntax will be different for other databases. Note that stored ORACLE procedures can NOT be called from the ODBC functions, instead you must use either ADO function calls in the DIA
dem VBScript or the OO4O COM wrapper that ORACLE provides (this is described in further detail in the below Word document).
Hope this helps,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
Attachments:
Calling_ORACLE_Stored_Procedures_from_DIAdem.doc 28 KB -
How to Execute SSIS package through MySQL Procedure
Hi Everyone,
How to Execute SSIS package from MySQL Stored Procedure.
Please share your suggestions on this.
Regards,
VaishuI am not sure whether you have SSIS license version installed in the system where MYSQL is there. In order to run SSIS package we need to have DTEXEC executable file and it comes with SSIS license version.
An SSIS package can be executed from command prompt as,
C:\>dtexec /f E:\package.dtsx
I am not expert in MYSQL however in TSQL we can run dos command or scripting language such as vbscript.
Similarly you need to check in MYSQL. This is MSSQL Server forum.
Refer
http://www.ehow.com/how_8789576_call-ssis-package-vbscript.html
http://www.mssqltips.com/sqlservertip/1775/different-ways-to-execute-a-sql-server-ssis-package/
Regards, RSingh -
How to select the printer and select the ICC profile for printing with VBScript?
I try to automate my printing procedure in photoshop. The problem is that I don't know how to select the printer and select the icc profile for printing with vbscript like I manually do in the print-menu in photoshop?
Anyone has done this before?
Thanx!
jusClient/Server version:
- D2KWUTIL.PLL library provides a 'Select Printer' dialog box to be used in Forms: WIN_API_DIALOG.SELECT_PRINTER
http://guenter-huerkamp.dyndns.org/oracle-doc/docs/html/d2kwutil.html
I suggest you to create a form to invoke the report, allowing user to select the printer and then pass it as parameter DESNAME -
How to list long file names and paths longer than 260 characters in vbscript?
Hi there,
I have looked in different posts and forums, but couldn't find an answer to my question.
So, here it is... imagine the small piece of code attached below. I need to be able to iterate and rename recursively (I didn't include the recursive part of the code in order to keep things simple) through files and folders in an user selected path. I thought that by using vbscript FileSystemObject I would be able to do so.
Unfortunately, it seems like the Files method does not detect files whose path is larger than the OS 260 (or 256?) character limit. How could I do it so? Please, don't tell me to use something different than vbscripts :-)
Thanks in advance!
Set FSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = FSO.GetFolder(Path)
Set colFiles = objFolder.Files
For Each objFile In colFiles
Wscript.Echo "File in root folder:" & objfile.Name
NextYes, that describes the problem, but not the solution - short of changing the names of the folders. There is another solution. That is, to map a logical drive to the folder so that the path to subfolders and files is shortened. Here is a procedure that offers a scripted approach that I use to map folders with long names to a drive letter and then opens a console window at that location ...
Dim sDrive, sSharePath, sShareName, aTemp, cLtr, errnum
Const sCmd = "%comspec% /k color f0 & title "
Const bForce = True
if wsh.arguments.count > 0 then
sSharePath = wsh.arguments(0)
aTemp = Split(sSharePath, "\")
sShareName = aTemp(UBound(aTemp))
cLtr = "K"
with CreateObject("Scripting.FileSystemObject")
Do While .DriveExists(cLtr) and UCase(cLtr) <= "Z"
cLtr = Chr(ASC(cLtr) + 1)
Loop
end with
sDrive = cLtr & ":"
Else
sDrive = "K:"
sSharePath = "C:\Documents and Settings\tlavedas\My Documents\Script\Testing"
sShareName = "Testing"
end if
with CreateObject("Wscript.Network")
errnum = MakeShare(sSharePath, sShareName)
if errnum = 0 or errnum = 22 then
.MapNetworkDrive sDrive, "\\" & .ComputerName & "\" & sShareName
CreateObject("Wscript.Shell").Run sCmd & sDrive & sShareName & "& " & sDrive, 1, True
.RemoveNetworkDrive sDrive, bForce
if not errnum = 22 then RemoveShare(sShareName)
else
wsh.echo "Failed"
end if
end with
function MakeShare(sSharePath, sShareName)
Const FILE_SHARE = 0
Const MAX_CONNECT = 1
with GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
with .Get("Win32_Share")
MakeShare = .Create(sSharePath, sShareName, FILE_SHARE, MAX_CONNECT, sShareName)
end with
end with
end function
sub RemoveShare(sShareName)
Dim cShares, oShare
with GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Set cShares = .ExecQuery _
("Select * from Win32_Share Where Name = '" & sShareName & "'")
For Each oShare in cShares
oShare.Delete
Next
end with
end sub
The SHARE that must be created for this to work is marked as having only one connect (the calling procedure). The mapping and share is automatically removed when the console window is closed. In the case cited in this posting, this approach could be applied using the subroutines provided so that the user's script creates the share/mapping, performs its file operations and then removes the mapping/share. Ultimately, it might be more useful to change the folder structure, as suggested in the KB article, since working with the created folders and files will still be problematic - unless the drive mapping is in place.Tom Lavedas -
OK, something seemed to have changed with my system because this error is NEW. It might be related to my system upgrade from Vista to Win7, but just guessing here.
I run a database on a corporate MS Sql Server (2005) and an ASP application that connects via ODBC. The real world application works fine, however when I attempt to access Stored Procedures from Dreamweaver (on my development machine) I am getting the following error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'dbo.sp_SPNAMEHERE'.
This only seems to happen on Stored procedures that RETURN a recordset.
system:
Win7
Dreamweaver CS4
Code: VBScript/Classic ASP
SQL Server 2005
Connecting via ODBC: MM_MY_STRING = "Driver={SQL Server};Server=wscxxxxxxxxx;Database=dbsystem;Uid=username;Pwd=XXXXXXXXXXXX"
Stored procedures that do not return a recordset are not an issue.... this has put my development work at a standstill!!
Thanks in advance!Well, I hate bumps, but I am really running out of solutions. I have now tried to use a system DSN on my development machine and that didnt solve the problem. I just un-installed DW and re-installed it and that didnt solve my problem either.
This is very frustrating, because I cannot use any stored procs that return recordsets... I am stuck... can anybody think of a relatively easy work-around to working in DW w/ recordsets that come from SPs when you cant actually access them?
The really weird thing is, when I build the command, and choose the stored proc, and give it valid input variables, and TEST it from the TEST button, everything works and data is returned as expected. Once I click "OK" and actually add it to the ASP page the recordset that should be visible isnt... and when I click the plus sign in the bindings window I get the error...
Help!! -
how can i run an update procedure only if 2 fields values
already exist, in which case i would run an insert procedure?
i am using asp vbscript
something like .....
if field1 = value1
and field2 = value2
then
update......
else
insert.....Ouch, dude. That's total gibberish. Also, you don't write
mark-up to do an
insert; you write a server script (or "code" to be super
generic). Markup
is what you used to make the form.
Anyway:
<%
If Inv_total = 0 Then
set Insert = Server.CreateObject("ADODB.Command")
Insert.ActiveConnection = MM_Inv_STRING
Insert.CommandText = "INSERT INTO Inv (Date, ID, Count)
VALUES ( date,
" & urlparameter & " , 1) "
Insert.CommandType = 1
Insert.CommandTimeout = 0
Insert.Prepared = true
Insert.Execute()
ElseIf Inv_total > 1 Then
set Update = Server.CreateObject("ADODB.Command")
Update.ActiveConnection = MM_Inv_STRING
Update.CommandText = "UPDATE Inv SET Count = Count +1 WHERE
Inv.ID = "
& urlparameter
Update.CommandType = 1
Update.CommandTimeout = 0
Update.Prepared = true
Update.Execute()
End If
%> -
Hai to all,
i want to call LabVIEW_VI(Activex Server) from VBScript. That VBScript include onther COM Server. i want to data exchange between VBScript and LabVIEW. That parameters shouldbe two types, I mean some parameters ByVal and some ByRef.
How can i call?
Request: How to create VI function with ByRef parameter in LabVIEW.
ex: in 'C++': LabVIEWFunction(short* numb1, CString* str1).
Note: i am using LabVIEW 7.0 Express.
Thanks for advance!Hello.
I am not sure if I understand correctly. Sure, you can access both controls (inputs) and indicators (outputs) with the LabVIEW ActiveX server. If you use the call function i mentioned in my last answer, you might pass two arrays to the function. One array with the control/ indicator names and another one containing the values. After calling the VI you will find the data of the VI outputs inside the values-array.
Have a look at the attatched ZIP file. It contains a simple example showing the procedure.
Attachments:
callVI.zip 8 KB -
Simple call to stored function from asp (vbscript) adodb
please let me know if this question would be better suited to another forum.
i am simply attempting to call an oracle stored function that returns a varchar2 from an asp vbscript page using adodb. i have calling of stored procedures working fine.
attempting to call the function with the following code:
set sp_aprvd_cr = Server.CreateObject("ADODB.Command")
sp_aprvd_cr.ActiveConnection = MM_MHR_CONN_STR_STRING
sp_aprvd_cr.CommandType = 4
sp_aprvd_cr.CommandTimeout = 0
sp_aprvd_cr.Prepared = true
sp_aprvd_cr.CommandText = "PMS.sp_hpmsq054_aprvd_cr"
sp_aprvd_cr.Parameters.Append sp_aprvd_cr.CreateParameter("IP_PMSPT_ID", 200, 1,10,sp_aprvd_cr__P_PMSPT_ID)
sp_aprvd_cr.Parameters.Append sp_aprvd_cr.CreateParameter("return_param", adVarchar, adParamOutput)
set rst_aprvd_cr = sp_aprvd_cr.Execute
suspect that preparing the return code is where i am having troubles.
any examples or assistance would be greatly appreciated.
thanks in advance.Return value from stored function must be the first parameter in the parameters collection.
So, try this instead,
sp_aprvd_cr.Parameters.Append sp_aprvd_cr.CreateParameter("return_param", adVarchar, adParamOutput)
sp_aprvd_cr.Parameters.Append sp_aprvd_cr.CreateParameter("IP_PMSPT_ID", 200, 1,10,sp_aprvd_cr__P_PMSPT_ID)Cheers,
NH -
How to implement & run VBScript within SQL 2008?
Hello what are the steps to implement/configure a VBScript (with .config file) with SQL 2008?
(The VBScript file is a sync process that does DMLs within the SQL Server DB that it's on and also updates data on an exterior DB.)
(Perhaps within a Stored Procedure-Job best way?)
Thanks in advance.Although you could probably accomplish this with a SQLCLR proc, my opinion is an ETL process is better suited for SSIS. I suggest a job that executes an SSIS package with a Script task. You can use SSIS configurations to pass the configurable
value to the script at run time via package variables.
Dan Guzman, SQL Server MVP, http://www.dbdelta.com -
VBScript / Microsoft Script Control
I would like to call VBScript from TestStand using Automation Server Microsoft Script Control 1.0.
Which class I have to use to call a procedure or function in a .vbs file ? Where do I have to specified the .vbs file used ?Hi,
I think this is explained following this link: http://digital.ni.com/public.nsf/allkb/99A8713C51A4DE368625700D005BD795?OpenDocument
Regards
Jean-Luc D. NI France
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
Journées techniques : du contrôle d'instruments aux bancs de test
Du 4 au 13 juin : Grenoble - Pari... -
I have a vbscript(xxx.vbs) on my local machine and would like to kick this from an oracle procedure. Any Ideas???
Assuming you can expose this in a DLL (my VBScript is rusty, but I'm pretty confident you can), you can set up an external procedure that would call the script. I'm assuming that the script will live on the database machine here.
Justin -
Call vbscript from Apex button
I have added a vbscript to the header section of my page and I'm trying to call this from a button. Is this possible? Can anyone post an example of how this would be done. I've tried calling from the URL redirect section, along with many other things and can't get anything to work. I'm not sure if I added in the header wrong or if I'm calling it wrong.
ThanksWhat about placing outputs from the procedure to fields on the form?
Here is the procedure I have created:
procedure vatTotal (Order_no IN number,Total2 OUT number)
AS
CURSOR c_vatTotal is
select order_line.quantity, gre_product.cost from ord, gre_product, order_line where ord.order_no = order_line.order_no AND
gre_product.prod_no = order_line.Product_no;
Total number;
begin
Total:= 0;
for c_record in c_vatTotal loop
Total := Total + c_record.quantity * c_record.cost;
end loop;
Total2 := Total;
end;
I believe this is correct. It compiles.
I tried using Total as an out parameter but received the "duplicate fields in RECORD, TABLE or argument list are not permitted" error.
Maybe you are looking for
-
DUPLICATE DOCUMENT CHECK IN SAP
HI I NEED TO KNOW WHICH DOCUMENT YOU SAID DUPLICATE ONE ie. 1> 2> doc date "1.1.2011" Doc. Date 1.1.2011 postin date "1.1.2011" Posting Date : "1.1.2011" Reference : "abcd"
-
Pause/glitch in photo slideshows at chapter changes
Hi all. I'm a wedding photographer and use iDVD to make slideshows for my clients of their wedding day. I usually make separate slideshows for getting ready, the ceremony and the reception. If a particular slideshow is longer than seven minutes or so
-
Error in table binding (Select an attribute of type string)
Dear All, I'm doing the <i>TUT_FLIGHTLIST</i>example of the webdynpro. Now i'm struck at the step of Table Binding. <b>System says that error for UI element...select an attribute of type string.</b>. Please suggest. Thanks, Anup.
-
Airport Express - warranty/applecare ?!
hi all, about a week ago I've purchased an Airport Express and since the purchase day I'm trying to register it under my 2 months old AppleCare, but even if the registration process goes smoothly, I'm receiving no feedback from Apple and when I'm che
-
I have created a one-page (oversize) PDF file of my family tree using FamilyTreeMaker 2012, which runs on my laptop whose OS is W7. The resultant file can be opened in Adobe Reader (11.0.2), and all the information is visible. However, when I copy