Oracle存储过程挑战

Oracle存储过程挑战,oracle,syntax,plsql,compiler-errors,ora-06550,Oracle,Syntax,Plsql,Compiler Errors,Ora 06550,我正在从T-SQL转换到PL/SQL,在我的第一次尝试中,我试图创建一个存储过程(PL/SQL)来将数据加载到表中,但我遇到了一个错误: PL/SQL: SQL Statement ignored ORA-06550: line 29, column 4: PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following: 代码: 声明 v_str VARCHAR2(32767):=

我正在从
T-SQL
转换到
PL/SQL
,在我的第一次尝试中,我试图创建一个存储过程(
PL/SQL
)来将数据加载到表中,但我遇到了一个错误:

PL/SQL: SQL Statement ignored  
ORA-06550: line 29, column 4:  
PLS-00103: Encountered the symbol "end-of-file" when expecting one of the  following:
代码:

声明
v_str VARCHAR2(32767):='
0
10
普鲁巴
';
v_xml XMLTYPE:=XMLTYPE(v_str);
开始
选择x.AccountNum,x.CreditMax
从t
,XMLTABLE(“/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable”
传递t.xml
列AccountNum编号路径“/CustTable/AccountNum”
,CreditMax编号路径'/REC/CreditMax'
)x
结束;

您缺少分号
在select语句之后。每个语句都必须以
结尾

declare
  v_str VARCHAR2(32767) := '<ns0:ConnCustomerOrgServiceCreateRequest xmlns:ns0="http://tempuri.org" xmlns:ns6="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnItemSvc" xmlns:ns4="http://schemas.microsoft.com/dynamics/2011/02/documents/DocumentPaging" xmlns:ns7="http://schemas.microsoft.com/dynamics/2011/02/documents/EntityKeyPage" xmlns:ns5="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey" xmlns:ns1="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes" xmlns:ns3="http://schemas.microsoft.com/dynamics/2006/02/documents/QueryCriteria" xmlns:ns8="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKeyList" xmlns:ns2="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnCustomerOrg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns2:ConnCustomerOrg>
        <ns2:CustTable class="entity">
            <ns2:AccountNum xsi:nil="true" />
            <ns2:CreditMax>0</ns2:CreditMax>
            <ns2:CustGroup>10</ns2:CustGroup>
            <ns2:Organization class="entity">
                <ns2:NumberOfEmployees xsi:nil="true" />
                <ns2:OrganizationName class="entity">
                    <ns2:Name>PRUEBA</ns2:Name>
                </ns2:OrganizationName>
            </ns2:Organization>
        </ns2:CustTable>
    </ns2:ConnCustomerOrg>
</ns0:ConnCustomerOrgServiceCreateRequest>
';
  v_xml XMLTYPE := XMLTYPE(v_str);
begin
select x.AccountNum, x.CreditMax
from t
    ,XMLTABLE('/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable'
              PASSING t.xml
              COLUMNS AccountNum  NUMBER PATH '/CustTable/AccountNum'
                     ,CreditMax   NUMBER PATH '/REC/CreditMax'

             ) x;

end;
声明
v_str VARCHAR2(32767):='
0
10
普鲁巴
';
v_xml XMLTYPE:=XMLTYPE(v_str);
开始
选择x.AccountNum,x.CreditMax
从t
,XMLTABLE(“/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable”
传递t.xml
列AccountNum编号路径“/CustTable/AccountNum”
,CreditMax编号路径'/REC/CreditMax'
)x;
结束;

您缺少分号
在select语句之后。每个语句都必须以
结尾

declare
  v_str VARCHAR2(32767) := '<ns0:ConnCustomerOrgServiceCreateRequest xmlns:ns0="http://tempuri.org" xmlns:ns6="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnItemSvc" xmlns:ns4="http://schemas.microsoft.com/dynamics/2011/02/documents/DocumentPaging" xmlns:ns7="http://schemas.microsoft.com/dynamics/2011/02/documents/EntityKeyPage" xmlns:ns5="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey" xmlns:ns1="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes" xmlns:ns3="http://schemas.microsoft.com/dynamics/2006/02/documents/QueryCriteria" xmlns:ns8="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKeyList" xmlns:ns2="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnCustomerOrg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns2:ConnCustomerOrg>
        <ns2:CustTable class="entity">
            <ns2:AccountNum xsi:nil="true" />
            <ns2:CreditMax>0</ns2:CreditMax>
            <ns2:CustGroup>10</ns2:CustGroup>
            <ns2:Organization class="entity">
                <ns2:NumberOfEmployees xsi:nil="true" />
                <ns2:OrganizationName class="entity">
                    <ns2:Name>PRUEBA</ns2:Name>
                </ns2:OrganizationName>
            </ns2:Organization>
        </ns2:CustTable>
    </ns2:ConnCustomerOrg>
</ns0:ConnCustomerOrgServiceCreateRequest>
';
  v_xml XMLTYPE := XMLTYPE(v_str);
begin
select x.AccountNum, x.CreditMax
from t
    ,XMLTABLE('/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable'
              PASSING t.xml
              COLUMNS AccountNum  NUMBER PATH '/CustTable/AccountNum'
                     ,CreditMax   NUMBER PATH '/REC/CreditMax'

             ) x;

end;
声明
v_str VARCHAR2(32767):='
0
10
普鲁巴
';
v_xml XMLTYPE:=XMLTYPE(v_str);
开始
选择x.AccountNum,x.CreditMax
从t
,XMLTABLE(“/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable”
传递t.xml
列AccountNum编号路径“/CustTable/AccountNum”
,CreditMax编号路径'/REC/CreditMax'
)x;
结束;

您缺少分号
在select语句之后。每个语句都必须以
结尾

declare
  v_str VARCHAR2(32767) := '<ns0:ConnCustomerOrgServiceCreateRequest xmlns:ns0="http://tempuri.org" xmlns:ns6="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnItemSvc" xmlns:ns4="http://schemas.microsoft.com/dynamics/2011/02/documents/DocumentPaging" xmlns:ns7="http://schemas.microsoft.com/dynamics/2011/02/documents/EntityKeyPage" xmlns:ns5="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey" xmlns:ns1="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes" xmlns:ns3="http://schemas.microsoft.com/dynamics/2006/02/documents/QueryCriteria" xmlns:ns8="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKeyList" xmlns:ns2="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnCustomerOrg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns2:ConnCustomerOrg>
        <ns2:CustTable class="entity">
            <ns2:AccountNum xsi:nil="true" />
            <ns2:CreditMax>0</ns2:CreditMax>
            <ns2:CustGroup>10</ns2:CustGroup>
            <ns2:Organization class="entity">
                <ns2:NumberOfEmployees xsi:nil="true" />
                <ns2:OrganizationName class="entity">
                    <ns2:Name>PRUEBA</ns2:Name>
                </ns2:OrganizationName>
            </ns2:Organization>
        </ns2:CustTable>
    </ns2:ConnCustomerOrg>
</ns0:ConnCustomerOrgServiceCreateRequest>
';
  v_xml XMLTYPE := XMLTYPE(v_str);
begin
select x.AccountNum, x.CreditMax
from t
    ,XMLTABLE('/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable'
              PASSING t.xml
              COLUMNS AccountNum  NUMBER PATH '/CustTable/AccountNum'
                     ,CreditMax   NUMBER PATH '/REC/CreditMax'

             ) x;

end;
声明
v_str VARCHAR2(32767):='
0
10
普鲁巴
';
v_xml XMLTYPE:=XMLTYPE(v_str);
开始
选择x.AccountNum,x.CreditMax
从t
,XMLTABLE(“/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable”
传递t.xml
列AccountNum编号路径“/CustTable/AccountNum”
,CreditMax编号路径'/REC/CreditMax'
)x;
结束;

您缺少分号
在select语句之后。每个语句都必须以
结尾

declare
  v_str VARCHAR2(32767) := '<ns0:ConnCustomerOrgServiceCreateRequest xmlns:ns0="http://tempuri.org" xmlns:ns6="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnItemSvc" xmlns:ns4="http://schemas.microsoft.com/dynamics/2011/02/documents/DocumentPaging" xmlns:ns7="http://schemas.microsoft.com/dynamics/2011/02/documents/EntityKeyPage" xmlns:ns5="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey" xmlns:ns1="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes" xmlns:ns3="http://schemas.microsoft.com/dynamics/2006/02/documents/QueryCriteria" xmlns:ns8="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKeyList" xmlns:ns2="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnCustomerOrg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns2:ConnCustomerOrg>
        <ns2:CustTable class="entity">
            <ns2:AccountNum xsi:nil="true" />
            <ns2:CreditMax>0</ns2:CreditMax>
            <ns2:CustGroup>10</ns2:CustGroup>
            <ns2:Organization class="entity">
                <ns2:NumberOfEmployees xsi:nil="true" />
                <ns2:OrganizationName class="entity">
                    <ns2:Name>PRUEBA</ns2:Name>
                </ns2:OrganizationName>
            </ns2:Organization>
        </ns2:CustTable>
    </ns2:ConnCustomerOrg>
</ns0:ConnCustomerOrgServiceCreateRequest>
';
  v_xml XMLTYPE := XMLTYPE(v_str);
begin
select x.AccountNum, x.CreditMax
from t
    ,XMLTABLE('/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable'
              PASSING t.xml
              COLUMNS AccountNum  NUMBER PATH '/CustTable/AccountNum'
                     ,CreditMax   NUMBER PATH '/REC/CreditMax'

             ) x;

end;
声明
v_str VARCHAR2(32767):='
0
10
普鲁巴
';
v_xml XMLTYPE:=XMLTYPE(v_str);
开始
选择x.AccountNum,x.CreditMax
从t
,XMLTABLE(“/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable”
传递t.xml
列AccountNum编号路径“/CustTable/AccountNum”
,CreditMax编号路径'/REC/CreditMax'
)x;
结束;

在PL/SQL中使用SELECT语句时,必须有INTO子句。INTO子句允许您将值存储在声明的变量中,以便您可以随时在块内访问它们。试试这个:

declare
  v_str VARCHAR2(32767) := '<ns0:ConnCustomerOrgServiceCreateRequest xmlns:ns0="http://tempuri.org" xmlns:ns6="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnItemSvc" xmlns:ns4="http://schemas.microsoft.com/dynamics/2011/02/documents/DocumentPaging" xmlns:ns7="http://schemas.microsoft.com/dynamics/2011/02/documents/EntityKeyPage" xmlns:ns5="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey" xmlns:ns1="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes" xmlns:ns3="http://schemas.microsoft.com/dynamics/2006/02/documents/QueryCriteria" xmlns:ns8="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKeyList" xmlns:ns2="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnCustomerOrg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns2:ConnCustomerOrg>
        <ns2:CustTable class="entity">
            <ns2:AccountNum xsi:nil="true" />
            <ns2:CreditMax>0</ns2:CreditMax>
            <ns2:CustGroup>10</ns2:CustGroup>
            <ns2:Organization class="entity">
                <ns2:NumberOfEmployees xsi:nil="true" />
                <ns2:OrganizationName class="entity">
                    <ns2:Name>PRUEBA</ns2:Name>
                </ns2:OrganizationName>
            </ns2:Organization>
        </ns2:CustTable>
    </ns2:ConnCustomerOrg>
</ns0:ConnCustomerOrgServiceCreateRequest>
';


  v_xml XMLTYPE := XMLTYPE(v_str);
  v_accountnum VARCHAR2(2000);
  v_creditmax  VARCHAR2(2000);--i just assumed their datatypes since i cannot use %TYPE in here because i dont know what table accountnum and creditmax came from

BEGIN

SELECT x.AccountNum, x.CreditMax
INTO v_accountnum, v_creditmax
FROM t
    ,XMLTABLE('/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable'
              PASSING t.xml
              COLUMNS AccountNum  NUMBER PATH '/CustTable/AccountNum'
                     ,CreditMax   NUMBER PATH '/REC/CreditMax'

             ) x;

END;
声明
v_str VARCHAR2(32767):='
0
10
普鲁巴
';
v_xml XMLTYPE:=XMLTYPE(v_str);
v_accountnum VARCHAR2(2000年);
v_creditmax VARCHAR2(2000年)--我只是假设了它们的数据类型,因为我不能在这里使用%TYPE,因为我不知道accountnum和creditmax表来自何处
开始
选择x.AccountNum,x.CreditMax
进入v_accountnum,v_creditmax
从t
,XMLTABLE(“/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable”
传递t.xml
列AccountNum编号路径“/CustTable/AccountNum”
,CreditMax编号路径'/REC/CreditMax'
)x;
结束;

希望这有帮助。

在PL/SQL中使用SELECT语句时,必须有INTO子句。INTO子句允许您将值存储在声明的变量中,以便您可以随时在块内访问它们。试试这个:

declare
  v_str VARCHAR2(32767) := '<ns0:ConnCustomerOrgServiceCreateRequest xmlns:ns0="http://tempuri.org" xmlns:ns6="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnItemSvc" xmlns:ns4="http://schemas.microsoft.com/dynamics/2011/02/documents/DocumentPaging" xmlns:ns7="http://schemas.microsoft.com/dynamics/2011/02/documents/EntityKeyPage" xmlns:ns5="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey" xmlns:ns1="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes" xmlns:ns3="http://schemas.microsoft.com/dynamics/2006/02/documents/QueryCriteria" xmlns:ns8="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKeyList" xmlns:ns2="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnCustomerOrg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns2:ConnCustomerOrg>
        <ns2:CustTable class="entity">
            <ns2:AccountNum xsi:nil="true" />
            <ns2:CreditMax>0</ns2:CreditMax>
            <ns2:CustGroup>10</ns2:CustGroup>
            <ns2:Organization class="entity">
                <ns2:NumberOfEmployees xsi:nil="true" />
                <ns2:OrganizationName class="entity">
                    <ns2:Name>PRUEBA</ns2:Name>
                </ns2:OrganizationName>
            </ns2:Organization>
        </ns2:CustTable>
    </ns2:ConnCustomerOrg>
</ns0:ConnCustomerOrgServiceCreateRequest>
';


  v_xml XMLTYPE := XMLTYPE(v_str);
  v_accountnum VARCHAR2(2000);
  v_creditmax  VARCHAR2(2000);--i just assumed their datatypes since i cannot use %TYPE in here because i dont know what table accountnum and creditmax came from

BEGIN

SELECT x.AccountNum, x.CreditMax
INTO v_accountnum, v_creditmax
FROM t
    ,XMLTABLE('/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable'
              PASSING t.xml
              COLUMNS AccountNum  NUMBER PATH '/CustTable/AccountNum'
                     ,CreditMax   NUMBER PATH '/REC/CreditMax'

             ) x;

END;
声明
v_str VARCHAR2(32767):='
0
10
普鲁巴
';
v_xml XMLTYPE:=XMLTYPE(v_str);
v_accountnum VARCHAR2(2000年);
v_creditmax VARCHAR2(2000年)--我只是假设了它们的数据类型,因为我不能在这里使用%TYPE,因为我不知道accountnum和creditmax表来自何处
开始
选择x.AccountNum,x.CreditMax
进入v_accountnum,v_creditmax
从t
,XMLTABLE(“/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable”
传递t.xml
列AccountNum编号路径“/CustTable/AccountNum”
,CreditMax编号路径'/REC/CreditMax'
)x;
结束;

希望这有帮助。

在PL/SQL中使用SELECT语句时,必须有INTO子句。INTO子句允许您将值存储在声明的变量中,以便您可以随时在块内访问它们。试试这个:

declare
  v_str VARCHAR2(32767) := '<ns0:ConnCustomerOrgServiceCreateRequest xmlns:ns0="http://tempuri.org" xmlns:ns6="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnItemSvc" xmlns:ns4="http://schemas.microsoft.com/dynamics/2011/02/documents/DocumentPaging" xmlns:ns7="http://schemas.microsoft.com/dynamics/2011/02/documents/EntityKeyPage" xmlns:ns5="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey" xmlns:ns1="http://schemas.microsoft.com/dynamics/2008/01/sharedtypes" xmlns:ns3="http://schemas.microsoft.com/dynamics/2006/02/documents/QueryCriteria" xmlns:ns8="http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKeyList" xmlns:ns2="http://schemas.microsoft.com/dynamics/2008/01/documents/ConnCustomerOrg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <ns2:ConnCustomerOrg>
        <ns2:CustTable class="entity">
            <ns2:AccountNum xsi:nil="true" />
            <ns2:CreditMax>0</ns2:CreditMax>
            <ns2:CustGroup>10</ns2:CustGroup>
            <ns2:Organization class="entity">
                <ns2:NumberOfEmployees xsi:nil="true" />
                <ns2:OrganizationName class="entity">
                    <ns2:Name>PRUEBA</ns2:Name>
                </ns2:OrganizationName>
            </ns2:Organization>
        </ns2:CustTable>
    </ns2:ConnCustomerOrg>
</ns0:ConnCustomerOrgServiceCreateRequest>
';


  v_xml XMLTYPE := XMLTYPE(v_str);
  v_accountnum VARCHAR2(2000);
  v_creditmax  VARCHAR2(2000);--i just assumed their datatypes since i cannot use %TYPE in here because i dont know what table accountnum and creditmax came from

BEGIN

SELECT x.AccountNum, x.CreditMax
INTO v_accountnum, v_creditmax
FROM t
    ,XMLTABLE('/ConnCustomerOrgServiceCreateRequest/ConnCustomerOrg/CustTable'
              PASSING t.xml
              COLUMNS AccountNum  NUMBER PATH '/CustTable/AccountNum'
                     ,CreditMax   NUMBER PATH '/REC/CreditMax'

             ) x;

END;
declar