Call procedure of Oracle apps by C# not working - asp.net-mvc

Call procedure from C#:
DataSet ds = new DataSet();
using (OracleConnection con = new OracleConnection(WebConfigurationManager.ConnectionStrings["DataContext"].ConnectionString))
{
using (OracleCommand cmd = new OracleCommand("CS_SERVICEREQUEST_PUB.GET_SR_NOTES_DETAILS", con))
{
con.Open();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Clear();
OracleParameter p_api_version = cmd.Parameters.Add("p_api_version", OracleDbType.Int32);
p_api_version.Direction = ParameterDirection.Input;
p_api_version.Value = 4;
OracleParameter p_incident_id = cmd.Parameters.Add("p_incident_id", OracleDbType.Int32);
p_incident_id.Direction = ParameterDirection.Input;
p_incident_id.Value = 860636;
OracleParameter p_incident_number = cmd.Parameters.Add("p_incident_number", OracleDbType.Varchar2, 50);
p_incident_number.Direction = ParameterDirection.Input;
p_incident_number.Value = "480777";
OracleParameter x_notes = cmd.Parameters.Add("x_notes", null); // having issue with this
x_notes.Direction = ParameterDirection.Output;
OracleParameter x_return_status = cmd.Parameters.Add("x_return_status", OracleDbType.Varchar2, 50);
x_return_status.Direction = ParameterDirection.Output;
OracleParameter x_msg_count = cmd.Parameters.Add("x_msg_count", OracleDbType.Varchar2, 50);
x_msg_count.Direction = ParameterDirection.Output;
OracleParameter x_msg_data = cmd.Parameters.Add("x_msg_data", OracleDbType.Varchar2, 50);
x_msg_data.Direction = ParameterDirection.Output;
using (OracleTransaction tran = con.BeginTransaction(IsolationLevel.ReadCommitted))
{
try
{
cmd.Transaction = tran;
cmd.ExecuteNonQuery();
using (OracleDataAdapter da = new OracleDataAdapter())
{
da.SelectCommand = cmd;
da.Fill(ds);
}
tran.Commit();
}
catch (OracleException ex)
{
tran.Rollback();
}
finally
{
con.Close();
}
}
}
}
Procedure in Oracle apps:
PROCEDURE GET_SR_NOTES_DETAILS
( p_api_version IN NUMBER,
p_incident_id IN NUMBER ,
p_incident_number IN VARCHAR2,
x_notes OUT NOCOPY sr_notes_det_table,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY VARCHAR2,
x_msg_data OUT NOCOPY VARCHAR2)
IS
l_incident_id number := null;
l_sr_found number := 1;
l_api_name VARCHAR2(100) := 'CS_SERVICEREQUEST_PUB.GET_SR_NOTES_DETAILS';
l_count NUMBER := 0;
--l_tasks tasks_table;
--l_notes notes_table;
--l_sr_rec sr_records_cur%ROWTYPE;
BEGIN
--initialize the msg count to 0
x_msg_count := 0;
x_msg_data := null;
IF (p_incident_id IS NULL) AND (p_incident_number IS NOT NULL) THEN
BEGIN
select incident_id into l_incident_id
from cs_incidents_all_b
where incident_number = p_incident_number;
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_sr_found := 0;
END;
ELSE
l_incident_id := p_incident_id;
END IF;
IF l_sr_found = 1 THEN
BEGIN
select a.NOTES,
a.NOTES_DETAIL,
a.NOTE_TYPE,
a.NOTE_TYPE_MEANING,
a.NOTE_STATUS,
a.NOTE_STATUS_MEANING,
a.CREATED_BY,
a.creation_date,
a.last_update_date,
DECODE(b.employee_id,NULL,(select d.party_name from hz_parties d where d.party_id=b.person_party_id),
DECODE(b.person_party_id,NULL,NULL,(select c.FULL_NAME from hr_employees c where c.employee_id=b.employee_id))) CREATED_BY_NAME,
DECODE(b.employee_id,NULL,'CUSTOMER','AGENT') CREATED_BY_USER_TYPE,
b.PERSON_PARTY_ID CONTACT_PARTY_ID
bulk collect into x_notes
from jtf_notes_vl a,fnd_user b
where a.source_object_id=l_incident_id AND a.source_object_code='SR' AND a.created_by = b.user_id
order by a.creation_date desc;
EXCEPTION
WHEN NO_DATA_FOUND THEN
x_return_status := 'S';
END;
END IF;
x_return_status := 'S';
EXCEPTION
WHEN FND_API.G_EXC_ERROR THEN
x_return_status := FND_API.G_RET_STS_ERROR;
FND_MSG_PUB.Count_And_Get
( p_count => x_msg_count,
p_data => x_msg_data
);
WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
FND_MSG_PUB.Count_And_Get
( p_count => x_msg_count,
p_data => x_msg_data
);
WHEN OTHERS THEN
x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR) THEN
FND_MSG_PUB.Add_Exc_Msg(G_PKG_NAME, l_api_name);
END IF;
FND_MSG_PUB.Count_And_Get
( p_count => x_msg_count,
p_data => x_msg_data
);
END GET_SR_NOTES_DETAILS;
--End changes for get sr related info
END CS_ServiceRequest_PUB;
Unable to call this procedure from c# because I did not find any oracledBtype which is used for
x_notes OUT NOCOPY sr_notes_det_table
Here code for sr_notes_det_table
TYPE SR_NOTES_DET_REC IS RECORD (
NOTES JTF_NOTES_VL.NOTES%TYPE ,
NOTES_DETAIL JTF_NOTES_VL.NOTES_DETAIL%TYPE ,
NOTE_TYPE JTF_NOTES_VL.NOTE_TYPE%TYPE ,
NOTE_TYPE_MEANING JTF_NOTES_VL.NOTE_TYPE_MEANING%TYPE ,
NOTE_STATUS JTF_NOTES_VL.NOTE_STATUS%TYPE ,
NOTE_STATUS_MEANING JTF_NOTES_VL.NOTE_STATUS_MEANING%TYPE ,
CREATED_BY JTF_NOTES_VL.CREATED_BY%TYPE,
CREATION_DATE JTF_NOTES_VL.CREATION_DATE%TYPE,
last_update_date JTF_NOTES_VL.last_update_date%TYPE,
CREATED_BY_NAME VARCHAR2(240),
CREATED_BY_USER_TYPE VARCHAR2(30),
CONTACT_PARTY_ID NUMBER);
TYPE sr_notes_det_table IS TABLE OF SR_NOTES_DET_REC INDEX BY BINARY_INTEGER;
in my procedure call I have only problem with this out parameter
OracleParameter x_notes = cmd.Parameters.Add("x_notes", null);
x_notes.Direction = ParameterDirection.Output;
How can I captured this output parameter value in c#. please help or guide me how can I implement this correctly into the C#.

Related

Getting parameter in ADO.Net exception when calling from angular

I had created an API in Dot net core. When I had tested it's working well & good through postman or ARC tools. But when calling from angular, It's throwing an sqlexception like : "An SqlParameter with parameter name #TotalRows is not contained by the SqlParameterCollection."
My wonder is how it's working in postman & why not in angular call.
My API dataaccess is like below :
public List<PoDetails> GetPoDetails(PoDetails pods, string vendor_id, out int TotalRows, int Timezone)
{
List<PoDetails> posList = new List<PoDetails>();
TotalRows = 0;
try
{
con = new SqlConnection(conString);
cmd = new SqlCommand("sp_cc_get_po_details", con);
cmd.Parameters.Clear();
cmd.CommandType = CommandType.StoredProcedure;
cmd = Util.AddConditionalParameterString(cmd, "#vendor_id", vendor_id);
cmd = Util.AddConditionalParameterString(cmd, "#sortBy", pods.sortBy);
cmd = Util.AddConditionalParameterString(cmd, "#sortDirection", pods.sortDirection);
cmd = Util.AddConditionalParameterInt(cmd, "#pageSize", pods.pageSize);
cmd = Util.AddConditionalParameterInt(cmd, "#page", pods.page);
cmd = Util.AddConditionalParameterInt(cmd, "#time_zone_offset", Timezone);
cmd.Parameters.Add(new SqlParameter("#TotalRows", SqlDbType.Int));
cmd.Parameters["#TotalRows"].Direction = ParameterDirection.Output;
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
TotalRows = Convert.ToInt32(cmd.Parameters["#TotalRows"].Value);
foreach (DataRow dr in dt.Rows)
{
PoDetails posobj = new PoDetails();
posobj.vendor_name = dr["vendor_name"].ToString();
posobj.create_date = Convert.ToDateTime(dr["create_date"].ToString());
posobj.po_id = Convert.ToInt32(dr["po_id"]);
posobj.po_amount = Convert.ToInt32(dr["po_amount"]);
posobj.invoice_count = Convert.ToInt32(dr["invoicecount"]);
if (dr["utilization_amount"] != DBNull.Value)
posobj.utilization_amount = Convert.ToInt32(dr["utilization_amount"]);
else
posobj.utilization_amount = 0;
posList.Add(posobj);
}
}
catch (Exception ec)
{
throw new Exception(ec.Message);
}
return posList;
}
My procedure was like below :
ALTER PROCEDURE [dbo].[sp_cc_get_po_details]
(
#vendor_id varchar(100) = null,
#sortBy varchar(50) = NULL,
#sortDirection varchar(50) = null,
#pageSize int = NULL,
#page int = NULL,
#TotalRows int = NULL output,
#time_zone_offset int = 0
)
AS
BEGIN
SELECT Count(I.invoice_id) as invoicecount, p.po_id,p.po_amount,p.vendor_id,
DATEADD(MINUTE, #time_zone_offset, p.create_date) AS create_date ,
v.vendor_name, sum(I.invoice_amount) as utilization_amount
into #TempResults
FROM po_details p left join invoice_details I on p.po_id = I.po_id
join vendor_details v on v.vendor_id = p.vendor_id
WHERE (#vendor_id is null or #vendor_id = '' or v.vendor_id = #vendor_id)
group by p.po_id, p.po_amount, p.vendor_id, p.create_date, v.vendor_name
-- Paging Logic --
Declare #StartingRow as int = 0
Declare #FirstRow as int
Declare #LastRow as int
select #TotalRows = count(*)
from #TempResults
set #StartingRow = (#pageSize * #page) + 1
if #pageSize is not null and #page is not null begin
set #FirstRow = ((#page - 1) * #pageSize) + 1
set #LastRow = #FirstRow + (#pageSize - 1)
end else if #pageSize is not null and #StartingRow is not null begin
set #FirstRow = #StartingRow
set #LastRow = #FirstRow + (#pageSize - 1)
end else begin
set #FirstRow = 0
set #LastRow = #TotalRows
end
------
-------------------
--select #FirstRow;
--select #LastRow;
Select * from
(
Select ROW_NUMBER() over
(
order by
case when #sortBy = 'vendor_id' and #sortDirection = 'desc' then vendor_id end desc,
case when #sortBy = 'vendor_id' and #sortDirection = 'asc' then vendor_id end asc,
case when #sortBy = 'vendor_name' and #sortDirection = 'desc' then vendor_name end desc,
case when #sortBy = 'vendor_name' and #sortDirection = 'asc' then vendor_name end asc,
vendor_id
) as RowNumber, * from #TempResults
) RowData
where RowNumber between #FirstRow and #LastRow
order by RowNumber
end

How to get result of complex query in redbeanphp

So I have this query
$sql = "set #row_number := 0;
SELECT *
FROM (
SELECT user_id, #row_number := #row_number +1 pos
FROM user
ORDER BY plays DESC
) AS row_to_return
WHERE user_id = '{$_SESSION['user']->user_id}'";
echo $sql;
$user_pos = R::exec($sql);
Have tried to use exec, findAll, findRow - no result.
This thing did the trick:
$sql = "SELECT *
FROM (
SELECT user_id, #row_number := #row_number +1 pos
FROM user
ORDER BY plays DESC
) AS row_to_return
WHERE user_id = '{$_SESSION['user']->user_id}'";
$set_sql = 'set #row_number := 0';
R::exec($set_sql);
$user_pos = R::getRow($sql);

Use MERGE statement in a stored procedure with Informix

I have a stored procedure like this : http://tinyurl.com/pbk8qfb
CREATE PROCEDURE PS_TAB_TSEN(NOMFIC VARCHAR(70), LIBSEN VARCHAR(35),
CODAPPFOF VARCHAR(3))
DEFINE NUMINTNAV VARCHAR(10);
BEGIN;
LET NUMINTNAV = '0';
SELECT TO_CHAR(NUM_INT_NAV) INTO NUMINTNAV
FROM TAB_INAV WHERE NOM_FIC = NOMFIC;
MERGE INTO TAB_TSEN T
USING (SELECT COD_SEN, LIBSEN AS LIB_SEN, CODAPPFOF AS COD_APP_FOF
FROM TAB_TSEN
WHERE COD_SEN = NUMINTNAV) AS S
ON (T.COD_SEN = S.COD_SEN)
WHEN MATCHED THEN
UPDATE SET T.COD_SEN = S.COD_SEN, T.LIB_SEN = S.LIB_SEN,
T.COD_APP_FOF = S.COD_APP_FOF
WHEN NOT MATCHED THEN
INSERT (T.COD_SEN, T.LIB_SEN, T.COD_APP_FOF)
VALUES (S.COD_SEN, S.LIB_SEN, S.COD_APP_FOF);
COMMIT;
END PROCEDURE;
When I run it all is good, but when I check in the table I see no result, for the insert statement and for the update statement too.
I call it like this:
CALL PS_TAB_TSEN('~/PSS/Order/OrderList.aspx', 'Liste des commandes', 'NET');
I don't understand what is going on...
Problem solved, I replace my stored procedure by this one :
CREATE PROCEDURE PS_TAB_TSEN(NOMFIC VARCHAR(70), LIBSEN VARCHAR(35), CODAPPFOF VARCHAR(3))
DEFINE ISPRESENT INTEGER;
DEFINE NUMINTNAV VARCHAR(10);
BEGIN;
LET NUMINTNAV = '0';
SELECT TO_CHAR(NUM_INT_NAV) INTO NUMINTNAV FROM TAB_INAV WHERE NOM_FIC = NOMFIC;
LET ISPRESENT = 0;
SELECT COUNT(*) INTO ISPRESENT FROM TAB_TSEN WHERE COD_SEN = NUMINTNAV;
IF(ISPRESENT > 0) THEN
UPDATE TAB_TSEN SET T.COD_SEN = S.COD_SEN, T.LIB_SEN = S.LIB_SEN, T.COD_APP_FOF = S.COD_APP_FOF
ELSE
INSERT INTO TAB_TSEN (T.COD_SEN, T.LIB_SEN, T.COD_APP_FOF) VALUES (S.COD_SEN, S.LIB_SEN, S.COD_APP_FOF);
END IF;
COMMIT;
END PROCEDURE;

First Try to SMPP Protocol (Bind Command)

i have a try to implement SMPP client , a first test is do bind after i have live socket connection.
but server show HEX Error message when receive the stream.
SMPP Unit
interface
uses Classes;
Type
// c octet strings
TSystemID = string[16];
TPassword = string[9];
TSystemType = string[13];
TAddr = string[21];
TAddr_Range = string[41];
TSvc_Type = string[6];
TDate_time = string[17];
TMsgID = string[65];
pPDU_HDR = ^TPDU_HDR;
TPDU_HDR = packed record
command_len : LongWord ;
command_id : LongWord ;
command_status :LongWord ;
command_number:LongWord ;
end;
pSMPP_BIND = ^TSMPP_BIND ;
TSMPP_BIND = packed record
SystemID : TSystemID ;
Password : TPassword ;
SystemType : TSystemType ;
Ver : Byte;
Addr_TON : Byte ;
Addr_NPI : Byte ;
Addr_Range : TAddr_Range ;
end;
const
{ max short message length }
DCS7_MAX_LEN = 160;
DCS8_MAX_LEN = 140;
DCSUCS2_MAX_LEN = DCS8_MAX_LEN div 2;
{ command ids }
cmdNull = $00000000;
cmdBindReceiver = $00000001;
cmdBindTransmitter = $00000002;
cmdQuery = $00000003;
cmdReplace = $00000007;
cmdCancel = $00000008;
cmdBindTransceiver = $00000009;
cmdOutbind = $0000000B;
cmdUnbind = $00000006;
cmdSubmitSM = $00000004;
cmdDeliverSM = $00000005;
cmdEnquireLink = $00000015;
cmdSubmitMultiply = $00000021;
cmdAlertNotification = $00000102;
cmdData = $00000103;
cmdGenericNack = $80000000;
cmdResponseBase = $80000000;
cmdBindReceiverResponse = $80000001;
cmdBindTransmitterResponse = $80000002;
cmdQueryResponse = $80000003;
cmdReplaceResponse = $80000007;
cmdCancelResponse = $80000008;
cmdBindTransceiverResponse = $80000009;
cmdUnbindResponse = $80000006;
cmdSubmitSMResponse = $80000004;
cmdDeliverSMResponse = $80000005;
cmdEnquireLinkResponse = $80000015;
cmdSubmitMultiplyResponse = $80000021;
cmdDataResponse = $80000103;
{ ESM_CLASS }
ESM_CLASS_DELIVERY_RECEIPT = $04;
ESM_CLASS_UDHI = $40;
implementation
end.
ON My Form btnSendBindClick
procedure TFrmMain.btnSendBindClick(Sender: TObject);
var hdr : TPDU_HDR ;
bind_pkt : TSMPP_BIND ;
mm : TMemoryStream ;
HdrPtr : pPDU_HDR ;
BindPtr : pSMPP_BIND ;
sysid : AnsiString ;
pass : AnsiString ;
systype : AnsiString ;
add_rn : AnsiString ;
begin
sysid := 'sysid';
pass := 'pass';
systype := 'sys_type';
add_rn := '';
hdr.command_id := htonl(cmdBindTransceiver) ;
hdr.command_status := htonl(cmdNull) ;
hdr.command_number := htonl(cmdBindTransmitter) ;
hdr.command_len := htonl(SizeOf(hdr)+SizeOf(bind_pkt));
bind_pkt.SystemID := pansiChar(sysid);
bind_pkt.Password := pansiChar(pass);
bind_pkt.SystemType := pansiChar(systype);
bind_pkt.Ver := 0 ;
bind_pkt.Addr_TON := 1 ;
bind_pkt.Addr_NPI := 1 ;
bind_pkt.Addr_Range := pansiChar(add_rn);
HdrPtr := #HdrPtr ;
BindPtr := #bind_pkt ;
mm := TMemoryStream.Create ;
mm.Write(HdrPtr^,SizeOf(hdr));
mm.Position := mm.Size;
mm.Write(BindPtr^,SizeOf(bind_pkt));
mm.Position := 0 ;
clnt.Socket.SendStream(mm);
end;
I think i need to encode data stream to something, but i am not sure .
I worked with SMPP in 1999/2000 last time, but at that time, specs. 3.4 said that fields like SystemID, Password etc..., i.e. declared as Var. Max nn, are of type C-OctetString.
So if the spec did not change, you completelly missed it: you cannot use records and similiar data structures, but you have to create an octet stream containing sequence of ASCIIZ strings with no padding, e.g. (using Delphi syntax): ...'SystemId'#0'Password'#0'SystemType'#0.... And if I remember it correctly, you should change endians for integer fields as well.

ExecuteSqlCommand with output parameter

I'm using Entity Framework in an ASP.NET MVC3 application and I'm trying to use the following code:
var token = "";
this.Database.ExecuteSqlCommand("exec dbo.MyUsp", new SqlParameter("token", token));
My stored proc signature is:
CREATE PROCEDURE MyUSP(#token varchar(10) OUT)
(...)
When I use this code I get an error saying that parameter "#token" was expected but not supplied.
How do I tell EF that the token parameter is for output?
I ended up using this to get it working, but I'm sure there's a more optimal way:
var p = new SqlParameter
{
ParameterName = "token",
DbType = System.Data.DbType.String,
Size = 100,
Direction = System.Data.ParameterDirection.Output
};
var resp = this.Database.SqlQuery<String>("exec dbo.usp_GetRequestToken #token", p);
return resp.First();
var outParam = new SqlParameter();
outParam.ParameterName = "OutPutParametname";
outParam.SqlDbType = SqlDbType.Bit;//DataType Of OutPut Parameter
outParam.Direction = ParameterDirection.Output;
db.Database.ExecuteSqlCommand("EXEC ProcedureName #Param1,#Param2 OUTPUT", new SqlParameter("Param1", value), outParam);
object outParamValue = Convert.ToBoolean(outParam.Value);
You need to indicate the direction in the parameter. For example, try something like this:
var p = new SqlParameter("token", token);
p.Direction = ParameterDirection.InputOutput;
this.Database.ExecuteSqlCommand("exec dbo.MyUsp", p);
I solved this issue with following SQL and Entity Framework code
SP :
ALTER PROCEDURE [dbo].[SaveSingleColumnValueFromGrid]
(
#TableName VARCHAR(200),
#ColumnName VARCHAR (200),
#CompareField VARCHAR(200),
#CompareValue VARCHAR(200),
#NewValue VARCHAR(200),
#Result INT OUTPUT
)
AS
BEGIN
DECLARE #SqlString NVARCHAR(2000),
#id INTEGER = 0;
IF #CompareValue = ''
BEGIN
SET #SqlString = 'INSERT INTO ' + #TableName + ' ( ' + #ColumnName + ' ) VALUES ( ''' + #NewValue + ''' ) ; SELECT #id = SCOPE_IDENTITY()';
EXECUTE sp_executesql #SqlString, N'#id INTEGER OUTPUT', #id OUTPUT
END
ELSE
BEGIN
SET #SqlString = 'UPDATE ' + #TableName + ' SET ' + #ColumnName + ' = ''' + #NewValue + ''' WHERE ' + #CompareField + ' = ''' + #CompareValue + '''';
EXECUTE sp_executesql #SqlString
set #id = ##ROWCOUNT
END
SELECT #Result = #id
END
Entity Framework Code :
public FieldUpdateResult SaveSingleColumnValueFromGrid(string tableName, string tableSetFieldName, string updatedValue, string tableCompareFieldName, string uniqueFieldValue)
{
var fieldUpdateResult = new FieldUpdateResult() ;
var isNewRecord = false;
if (string.IsNullOrWhiteSpace(uniqueFieldValue))
{
uniqueFieldValue = string.Empty;
isNewRecord = true;
}
using (var dbContext = new DBEntities())
{
var resultParameter = new SqlParameter("#Result", SqlDbType.Int)
{
Direction = ParameterDirection.Output
};
var recordsAffected = dbContext.Database.ExecuteSqlCommand("SaveSingleColumnValueFromGrid #TableName,#ColumnName,#CompareField,#CompareValue,#NewValue,#Result out",
new SqlParameter("#TableName", tableName),
new SqlParameter("#ColumnName", tableSetFieldName),
new SqlParameter("#CompareField", tableCompareFieldName),
new SqlParameter("#CompareValue", uniqueFieldValue),
new SqlParameter("#NewValue", updatedValue),
resultParameter);
fieldUpdateResult.Success = recordsAffected > 0;
if (isNewRecord)
{
fieldUpdateResult.NewId = (int)resultParameter.Value;
}
else
{
fieldUpdateResult.AffectedRows = (int)resultParameter.Value;
}
}
return fieldUpdateResult;
}
var db = new DBContext();
var outParam = new SqlParameter
{
ParameterName = "#Param",
DbType = System.Data.DbType.String,
Size = 20,
Direction = System.Data.ParameterDirection.Output
};
var r = db.Database.ExecuteSqlCommand("EXEC MyStoredProd #Param OUT",outParam );
Console.WriteLine(outParam.Value);
The main part i see everyone is missing, is the OUT keyword needed after #Param.
Below is what I do for Oracle using the DevArt driver. I have a package.proc called P_SID.SID_PGet that returns a single string value. The proc is:
PROCEDURE SID_PGet(io_SID OUT varchar2) is
Begin
io_SID:=GetSID; -- GetSID just goes off and gets the actual value
End;
Below is how I call it and retrieve the SID value (I'm using this with EF 4.1 code first and this method is in the DbContext):
/// <summary>
/// Get the next SID value from the database
/// </summary>
/// <returns>String in X12345 format</returns>
public string GetNextSId()
{
var parameter = new Devart.Data.Oracle.OracleParameter("io_SID", Devart.Data.Oracle.OracleDbType.VarChar, ParameterDirection.Output);
this.Database.ExecuteSqlCommand("BEGIN P_SID.SID_PGet(:io_SID); END;", parameter);
var sid = parameter.Value as string;
return sid;
}

Resources