function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nikoo.malek1.3927635000918623E12nikoo.malek1.3927635000918623E12 

Using Store procedure to call API

I wonder instead of using select statement like this to work with sales force Api:
SOQL = "select AuthorId,Name, Description,Type from Document";

Is there any way that  can use store procedure?
GunnarGunnar
You can create a method in a class that returns a list of documents. So the answer is yes.
nikoo.malek1.3927635000918623E12nikoo.malek1.3927635000918623E12
I know I can create a method. I want to know instead of using select statement how I can use store procedure. As here it uses SOQL instead of SQL. How you write store procedure here?
GunnarGunnar
Even stored procedures use SELECT statements. In essence, Apex is a stored procedure language like T-SQL and PL/SQL.

Can it be done without a SELECT anywhere? No.
nikoo.malek1.3927635000918623E12nikoo.malek1.3927635000918623E12
I haven’t got my answer yet. For example I wanted to know instead of having this select Statement:

SOQL = "select AuthorId,Name, Description,Type from Document";

can I use store procedure something similar to this:


using (SqlConnection conn = new SqlConnection(DataConnection.ConnectionString))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("Insert_tbl_Webhook", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlParameter NewID = new SqlParameter("@id", 0);
                NewID.Direction = ParameterDirection.Output;
                cmd.Parameters.Add(NewID);

                cmd.Parameters.Add(new SqlParameter("@event",webhook.@event));

....

I know I don't have SQL connection and all of this here I wanted to know what would be equivalent to this in sales force if I wanted to use store procedure?