PROCEDURE populate_boj_deposit_tab(asatdate IN VARCHAR2, in_sol IN VARCHAR2) AS
test_cnt BINARY_INTEGER;
startdate DATE;
codefound BINARY_INTEGER := 0;
counter BINARY_INTEGER := 0;
ex_indx BINARY_INTEGER := 1;
excludeAcct BINARY_INTEGER := 1;
arr_indx BINARY_INTEGER := 1;
deposit_table_obj deposit_record_table;
category_table_obj category_record_table;
exclusion_table_obj exclusion_record_table := exclusion_record_table();
report_array reports := reports();
INSERT /*+ APPEND */ INTO boj_deposit_portfolio
SELECT
customer_id,
SUM(GENERALFUNCTIONS.FN_ConvertAmountAsOfDate(asAtDate, currency,'JMD',sanctioned_ato,'REV')) AS sanctioned_ato
FROM
boj_raw_accounts_data
GROUP BY customer_id;
COMMIT;
--Find and populate exclusion table
EXECUTE IMMEDIATE 'TRUNCATE TABLE boj_deposits_exclusion';
--Get loans accounts for each report that does not match
SELECT
transaction_balance, acid, borrower_category_code, sector_code, sub_sector_code,
rep_date, customer_id, cust_code
BULK COLLECT INTO
deposit_table_obj
FROM bojdeposit_tab;
How can I convert this code to SQL SERVER I'm new to using Oracle without changing the functionality of the query? I'm okay with the data types and the other general stuff, the main concern is the bulk insert and table objects, for example, category_table_obj category_record_table;
Almost every line needs to be changed:
There is no type ** BINARY_INTEGER in SQL Server.
Assginment in SQL Server is done with an = sign not a := sign.
You can remove the commit - SQL Server starts a transaction with a begin transaction
General_functions in sql server would be interpreted as a schema name not package.
There is no execute immediate statement in SQL Server or bulk collect statement in SQL Server.
There are equivalent statements for all of these in SQL Server but it would require a lot of work (and someone who knows both SQL Server TSQL and Oracle OSQL).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.