I'm developping an app running stored procedures on an Oracle database. It works fine but now i'm trying to run procedures with Liquibase to have an independant environment and I can't get it to work. Even the simpliest 'Hello world' example gives me a SQL syntax error.
I'm just giving you the xml and error for now because i don't think it comes from the Spring part since it's working with the DB. The 'hello world' procedure itself works fine if I run it on SqlDeveloper.
Any help would be appreciated, I really don't have a clue what's wrong with this. Thank you !
The procedure :
<databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<changeSet id="PROC_PKG_ACCEPTOR_P_ACCEPTORMISCINIT-create"
author="sth" runOnChange="true">
<createProcedure dbms="h2, oracle"
encoding="UTF-8"
procedureName="TESTHELLO"
relativeToChangelogFile="true">
CREATE OR REPLACE PROCEDURE TESTHELLO
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello World!');
END;
</createProcedure>
</changeSet>
</databaseChangeLog>
The error :
Reason: liquibase.exception.DatabaseException: Erreur de syntaxe dans linstruction SQL {0}; attendu {1}
Syntax error in SQL statement {0}; expected {1}; SQL statement:
CREATE OR REPLACE PROCEDURE TESTHELLO
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello World!');
END [42001-197] [Failed SQL: CREATE OR REPLACE PROCEDURE TESTHELLO
IS
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello World!');
END]
http://www.h2database.com/html/features.html#user_defined_functions
So you can't do what I was trying at all with H2, seems the solution is to create an Alias for a Java function.
Thanks you guys
Related
Error in processing request: No routine with name `selectCategory` found
in database `xxx`.
This is my stored procedure
DELIMITER $$
CREATE DEFINER=`root`#`localhost` PROCEDURE `selectCategory`()
BEGIN
SELECT category_id, name AS display_name
FROM category
ORDER BY name;
END$$
DELIMITER ;
I am trying to run the stored procedure on the phpmyadmin site to check if the other problem I am having is due to php I wrote or the procedure itself, because of that error I cannot check and I do not know how to fix this error.
Is it possible that you are connecting to an instance which does not have the SP? check the db instance contains your SP.
While executing a simple stored procedure getting a warning compiled but compilation error how to see.
Below is the query:
create procedure spgetdat
as
begin
select empis empname, empadd from tb1employees;
end;
While executing above query getting an error. Pls suggest what needs to be corrected.
Regards
Jitendra
Your Select statement inside the procedure is not correct. There should be into clause in the select statement inside the PL/SQL block.
It can be like below. You have to put a where condition for selection of one record or for best practice you can use cursor to fetch more then one record also.
create procedure spgetdat
as
v_empis tab1employees.empis%type;
v_empadd tab1employees.empadd%type;
begin
select empis empname ,empadd into v_empis,v_empadd from tb1employees where empis = 'given name' ;
end;
show errors;
I have a weird issue with flyway upgrade. I have a upgrade script like this:
CREATE OR REPLACE PROCEDURE DBO.initData()
LANGUAGE SQL
BEGIN
CALL DBO.myProc(1);
CALL DBO.myProc(2);
CALL DBO.myProc(3);
CALL DBO.myProc(4);
CALL DBO.myProc(5);
CALL DBO.myProc(6);
......
CALL DBO.myProc(31);
END;
when I run it in Data Studio, everything is fine. But if i put it in flyway upgrade. It returns an syntax error. After some investigating, i found that flyway add a ";" in my last statement and make it likeCALL DBO.myProc(3;2);
For now i have to make two stored procedures to make it work:
init1:
CREATE OR REPLACE PROCEDURE DBO.initData()
LANGUAGE SQL
BEGIN
CALL DBO.myProc(1);
CALL DBO.myProc(2);
CALL DBO.myProc(3);
CALL DBO.myProc(4);
CALL DBO.myProc(5);
CALL DBO.myProc(6);
......
CALL DBO.myProc(31);
END;
init2:
CREATE OR REPLACE PROCEDURE DBO.initData2()
LANGUAGE SQL
BEGIN
CALL DBO.myProc(32);
END;
I am wondering if anyone knows what is wrong here?
Reproduce script:
CREATE OR REPLACE PROCEDURE DBO.wp_InitDataProc(
v_Name VARGRAPHIC(255)
)
LANGUAGE SQL
BEGIN
/*do nothing*/
END;
CREATE OR REPLACE PROCEDURE DBO.wp_InitData()
LANGUAGE SQL
BEGIN
CALL DBO.wp_InitDataProc(N'1');
CALL DBO.wp_InitDataProc(N'1');
CALL DBO.wp_InitDataProc(N'2');
END;
CALL DBO.wp_InitData();
DROP PROCEDURE DBO.wp_InitData;
DROP PROCEDURE DBO.wp_InitDataProc;
I set up an OLE Automation Server and an OLE Client in Delphi XE2. My two Methods are the following:
function TMyCom2.Get_Text() : IStrings;
begin
GetOleStrings(unit1.Form1.Memo1.Lines, Result);
end;
and:
procedure TMyCom2.Set_Text(const value: IStrings);
begin
SetOleStrings(unit1.Form1.Memo1.Lines, value);
end;
Now I tried to call both by the client.
The second Method(Set_Text) was working perfectly fine.
But the first one(Get_Text) wich should gather the content of the memo of the server and write it into the memo of the client, caused this exception:
Exception error of the server!
To get the Ole information I wrote this on the client side:
procedure TForm1.Button1Click(Sender: TObject);
var
aStrings : IStrings;
begin
aStrings.Add(Server.Get_Text);
SetOleStrings(Memo1.Lines, aStrings);
end;
I have no idea what could be wrong and I was incredibly grateful if somebody could take a look at this code and tell me what the hell is going wrong;D
PS: I already tested it with Integers and it worked so the Problem has to do something with Strings
I uploaded the two projects on Dropbox so feel free to download them:
Client: here
Server: here
We have an old application that was written in Delphi 7. It is currently connected to an old Oracle Lite database that is being retired. The powers that be have chosen to move the data to a Microsoft SQL Server Compact database instead. After sepending a good amount of time moving everything over to the SQL CE database, I am now tasked with getting the Delphi application to play nice with the new databases.
The people who are supposed to be smarter than I am (my boss), tell me that I should be able to simply modify the connection and everything should be back in order. However, I have been banging my head against my monitor for two days trying to get the ADO connection in the Delphi application to work with our new SQL CE database.
A slightly simplified example of what I'm working with:
The connection is made in a global object with a TADOConnection named "adoConn":
procedure TGlobal.DataModuleCreate(Sender: TObject);
begin
adoConn.ConnectionString := 'Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5;Data Source=path\db.sdf;';
adoConn.Connected := True;
end;
Shortly after this, a procedure is called to populate some messages. In an effort to trouble shoot the application, I've simplified the code to make a simple query and show the results in a message box. The procedure receives a parameter for the SQL string, but I'm ignoring it for now and manually inserting a simple select statement:
procedure Select(const SQL: string);
var
adoQuery : TADOQuery;
begin
adoQuery := TADOQuery.Create(nil);
try
adoQuery.Connection := Global.adoConn;
adoQuery.SQL.Text := 'select * from CLT_MESSAGES';
adoQuery.ExecSQL;
While not adoQuery.Eof do
begin
// Here I just created a MessageDlg to output a couple of fields.
adoQuery.Next;
end;
finally
adoQuery.Free;
end;
end;
Everything compiles just fine, but when I run the application I get the following error:
"Multiple-step operation generated errors. Check each status value."
I've done some additional trouble-shooting and found that the error is happening at adoQuery.ExecSQL. I've tried several different versions of the connection string and a couple different ways of trying to query the data, but it all ends up the same. I either can't connect to the database or I get that stupid "Mutliple-step" error.
I appreciate, in advance, any assistance that can be offered.
Don't use ExecSQL for queries that return recordsets.
Set either the AdoQuery.Active property to True or use AdoQuery.Open to execute a SELECT statement.
UPDATE
After changing your code we see the real error which is DB_E_OBJECTOPEN.
UPDATE2
After digging deeper it seems that this is a known bug in the OLE DB provider and nvarchar fields bigger than 127 characters.
these references seem to confirm this:
SO: SQL Server Compact Edition 3.5 gives "Multiple-step operation generated errors" error for simple query
ref1: http://www.tech-archive.net/Archive/SQL-Server/microsoft.public.sqlserver.ce/2008-07/msg00019.html
ref2: https://forums.embarcadero.com/thread.jspa?messageID=474517
ref3: http://social.msdn.microsoft.com/Forums/en-US/sqlce/thread/48815888-d4ee-42dd-b712-2168639e973c
Changing the cursor type to server side solved the 127 char issue for me :)