Я новичок в оракуле, и я пытаюсь создать sproc.В настоящее время у меня есть это:
procedure ListCatalogueEntries(P_CUR out sys_refcursor,
P_CATALOGUEID varchar2, P_UNIQUEPRODUCTS varchar2) is
BEGIN
IF P_UNIQUEPRODUCTS = 'Y' THEN
OPEN P_CUR FOR
SELECT
corprd.sku prodcode,
corprd.rangecode cor_rangecode,
corprd.rangename cor_rangename,
corprd.prodcode cor_colourcode,
corprd.prodname cor_colourname,
corprd.sku cor_partcode,
corprd.skudesc cor_partname,
corprd.proddesc cor_partdesc,
corprd.prodspec cor_partspec,
e.rangecode cus_rangecode,
e.rangename cus_rangename,
e.productcode cus_colourcode,
e.productname cus_colourname,
e.buyercode cus_partcode,
e.skudescription cus_partname,
e.skudescription cus_partspec
FROM
ccvw_web_products corprd
INNER JOIN
cc_ob_catalogueentries e
ON
corprd.sku = e.sku
WHERE
nvl(e.catalogueid,P_CATALOGUEID) = P_CATALOGUEID
ORDER BY
e.sku;
ELSE
OPEN P_CUR FOR
SELECT
corprd.sku prodcode,
corprd.rangecode cor_rangecode,
corprd.rangename cor_rangename,
corprd.prodcode cor_colourcode,
corprd.prodname cor_colourname,
corprd.sku cor_partcode,
corprd.skudesc cor_partname,
corprd.proddesc cor_partdesc,
corprd.prodspec cor_partspec,
e.rangecode cus_rangecode,
e.rangename cus_rangename,
e.productcode cus_colourcode,
e.productname cus_colourname,
e.buyercode cus_partcode,
e.skudescription cus_partname,
e.skudescription cus_partspec
FROM
ccvw_web_products corprd
LEFT OUTER JOIN
cc_ob_catalogueentries e
ON
corprd.rangecode = e.rangecode
WHERE
nvl(e.catalogueid,P_CATALOGUEID) = P_CATALOGUEID
ORDER BY
e.sku;
END IF;
END ListCatalogueEntries;
, который компилируется.На самом деле я пытаюсь добиться этого (это на MSSQL):
DECLARE @CatalogueId NVARCHAR(50)
DECLARE @Unique NVARCHAR(1)
SET @CatalogueId = 'Test'
SELECT @Unique = uniquecatalogue FROM cc_ob_catalogueheader WHERE Id = @CatalogueId
IF @Unique = 'N'
SELECT
corprd.sku prodcode,
corprd.rangecode cor_rangecode,
corprd.rangename cor_rangename,
corprd.prodcode cor_colourcode,
corprd.prodname cor_colourname,
corprd.sku cor_partcode,
corprd.skudesc cor_partname,
corprd.proddesc cor_partdesc,
corprd.prodspec cor_partspec,
e.rangecode cus_rangecode,
e.rangename cus_rangename,
e.productcode cus_colourcode,
e.productname cus_colourname,
e.buyercode cus_partcode,
e.skudescription cus_partname,
e.skudescription cus_partspec
FROM
ccvw_web_products corprd
INNER JOIN
cc_ob_catalogueentries e
ON
corprd.sku = e.sku
WHERE
nvl(e.catalogueid,P_CATALOGUEID) = P_CATALOGUEID
ORDER BY
e.sku;
ELSE
SELECT
corprd.sku prodcode,
corprd.rangecode cor_rangecode,
corprd.rangename cor_rangename,
corprd.prodcode cor_colourcode,
corprd.prodname cor_colourname,
corprd.sku cor_partcode,
corprd.skudesc cor_partname,
corprd.proddesc cor_partdesc,
corprd.prodspec cor_partspec,
e.rangecode cus_rangecode,
e.rangename cus_rangename,
e.productcode cus_colourcode,
e.productname cus_colourname,
e.buyercode cus_partcode,
e.skudescription cus_partname,
e.skudescription cus_partspec
FROM
ccvw_web_products corprd
LEFT OUTER JOIN
cc_ob_catalogueentries e
ON
corprd.rangecode = e.rangecode
WHERE
nvl(e.catalogueid,P_CATALOGUEID) = P_CATALOGUEID
ORDER BY
e.sku;
Может ли кто-нибудь помочь мне сделать это?